From 7f5d1b86c76c7afb401ec865617366670556a793 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 19 Apr 2025 19:44:47 -0700 Subject: [PATCH 01/13] Added keybind customization system --- CMakeLists.txt | 2 +- src/86box.c | 24 ++++-- src/config.c | 84 +++++++++++++++++++ src/device/keyboard.c | 21 ----- src/include/86box/86box.h | 18 ++-- src/qt/CMakeLists.txt | 5 ++ src/qt/qt.c | 2 +- src/qt/qt_mainwindow.cpp | 70 ++++++++++++++-- src/qt/qt_mainwindow.hpp | 6 +- src/qt/qt_settingsinput.cpp | 159 +++++++++++++++++++++++++++++++++++- src/qt/qt_settingsinput.hpp | 11 +++ src/qt/qt_settingsinput.ui | 118 ++++++++++++++++---------- 12 files changed, 429 insertions(+), 91 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 007c1ffd8..a6ffa89e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ if(WIN32) # Default value for the `WIN32` target property, which specifies whether # to build the application for the Windows GUI or console subsystem - option(CMAKE_WIN32_EXECUTABLE "Build a Windows GUI executable" ON) + option(CMAKE_WIN32_EXECUTABLE "Build a Windows GUI executable" OFF) else() # Prefer dynamic builds everywhere else set(PREFER_STATIC OFF) diff --git a/src/86box.c b/src/86box.c index 168e8a8dc..d8c05c8bb 100644 --- a/src/86box.c +++ b/src/86box.c @@ -222,6 +222,9 @@ int other_ide_present = 0; /* IDE control int other_scsi_present = 0; /* SCSI controllers from non-SCSI cards are present */ +// Accelerator key array +struct accelKey acc_keys[NUM_ACCELS]; + /* Statistics. */ extern int mmuflush; extern int readlnum; @@ -654,7 +657,6 @@ usage: #ifdef USE_INSTRUMENT printf("-J or --instrument name - set 'name' to be the profiling instrument\n"); #endif - printf("-K or --keycodes codes - set 'codes' to be the uncapture combination\n"); printf("-L or --logfile path - set 'path' to be the logfile\n"); printf("-M or --missing - dump missing machines and video cards\n"); printf("-N or --noconfirm - do not ask for confirmation on quit\n"); @@ -745,13 +747,6 @@ usage: do_nothing = 1; } else if (!strcasecmp(argv[c], "--nohook") || !strcasecmp(argv[c], "-W")) { hook_enabled = 0; - } else if (!strcasecmp(argv[c], "--keycodes") || !strcasecmp(argv[c], "-K")) { - if ((c + 1) == argc) - goto usage; - - sscanf(argv[++c], "%03hX,%03hX,%03hX,%03hX,%03hX,%03hX", - &key_prefix_1_1, &key_prefix_1_2, &key_prefix_2_1, &key_prefix_2_2, - &key_uncapture_1, &key_uncapture_2); } else if (!strcasecmp(argv[c], "--clearboth") || !strcasecmp(argv[c], "-X")) { if ((c + 1) == argc) goto usage; @@ -1789,3 +1784,16 @@ do_pause(int p) } atomic_store(&pause_ack, 0); } + +// Helper to find an accelerator key and return it's index in acc_keys +int FindAccelerator(const char *name) { + for(int x=0;x= QT_VERSION_CHECK(6, 0, 0) - auto windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_PageDown), this); + windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_PageDown), this); #else - auto windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_PageDown), this); + windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_PageDown), this); #endif windowedShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut); connect(windowedShortcut, &QShortcut::activated, this, [this] () { @@ -761,6 +762,8 @@ MainWindow::MainWindow(QWidget *parent) }); } #endif + + updateShortcuts(); } void @@ -826,6 +829,56 @@ MainWindow::closeEvent(QCloseEvent *event) event->accept(); } + +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 + + ui->actionTake_screenshot->setShortcut(QKeySequence()); + ui->actionCtrl_Alt_Del->setShortcut(QKeySequence()); + ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence()); + ui->actionFullscreen->setShortcut(QKeySequence()); + ui->actionHard_Reset->setShortcut(QKeySequence()); + + int accID; + QKeySequence seq; + + accID = FindAccelerator("screenshot"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionTake_screenshot->setShortcut(seq); + + accID = FindAccelerator("send_ctrl_alt_del"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionCtrl_Alt_Del->setShortcut(seq); + + accID = FindAccelerator("send_ctrl_alt_esc"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionCtrl_Alt_Esc->setShortcut(seq); + + accID = FindAccelerator("fullscreen"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + //printf("shortcut: %s\n", qPrintable(ui->actionFullscreen->shortcut().toString())); + ui->actionFullscreen->setShortcut(seq); + + accID = FindAccelerator("hard_reset"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionHard_Reset->setShortcut(seq); + + // To rebind leave_fullscreen we have to disconnect the existing signal, + // build a new shortcut, then connect it. + accID = FindAccelerator("leave_fullscreen"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + disconnect(windowedShortcut,0,0,0); + windowedShortcut = new QShortcut(seq, this); + windowedShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut); + connect(windowedShortcut, &QShortcut::activated, this, [this] () { + if (video_fullscreen) + ui->actionFullscreen->trigger(); + }); +} + void MainWindow::resizeEvent(QResizeEvent *event) { @@ -1026,6 +1079,8 @@ MainWindow::on_actionSettings_triggered() case QDialog::Accepted: settings.save(); config_changed = 2; + printf("about to try\n"); + updateShortcuts(); pc_reset_hard(); break; case QDialog::Rejected: @@ -1394,9 +1449,14 @@ MainWindow::keyPressEvent(QKeyEvent *event) #endif } - if (keyboard_ismsexit()) - plat_mouse_capture(0); - + // Check if mouse release combo has been entered + int accID = FindAccelerator("release_mouse"); + QKeySequence seq = QKeySequence::fromString(acc_keys[accID].seq); + if (seq[0] == (event->key() | event->modifiers())) + plat_mouse_capture(0); + + // TODO: Other accelerators should probably be here? + event->accept(); } diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 739d179ff..99b0021c2 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,8 @@ public: QSize getRenderWidgetSize(); void setSendKeyboardInput(bool enabled); void reloadAllRenderers(); - + QShortcut *windowedShortcut; + std::array, 8> renderers; signals: void paint(const QImage &image); @@ -159,6 +161,7 @@ private: std::unique_ptr status; std::shared_ptr mm; + void updateShortcuts(); void processKeyboardInput(bool down, uint32_t keycode); #ifdef Q_OS_MACOS uint32_t last_modifiers = 0; @@ -184,7 +187,6 @@ private: friend class RendererStack; // For UI variable access by non-primary renderer windows. friend class WindowsRawInputFilter; // Needed to reload renderers on style sheet changes. - bool isShowMessage = false; }; diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index d7c61e8d2..924594083 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -16,8 +16,11 @@ */ #include "qt_settingsinput.hpp" #include "ui_qt_settingsinput.h" +#include "qt_mainwindow.hpp" #include +#include +#include extern "C" { #include <86box/86box.h> @@ -25,11 +28,18 @@ extern "C" { #include <86box/machine.h> #include <86box/mouse.h> #include <86box/gameport.h> +#include <86box/ui.h> } #include "qt_models_common.hpp" #include "qt_deviceconfig.hpp" #include "qt_joystickconfiguration.hpp" +#include "qt_keybind.hpp" + +extern MainWindow *main_window; + +// Temporary working copy of key list +accelKey acc_keys_t[NUM_ACCELS]; SettingsInput::SettingsInput(QWidget *parent) : QWidget(parent) @@ -37,9 +47,55 @@ SettingsInput::SettingsInput(QWidget *parent) { ui->setupUi(this); + QStandardItemModel *model; + QStringList horizontalHeader; + QStringList verticalHeader; + + horizontalHeader.append("Action"); + horizontalHeader.append("Keybind"); + + QTableWidget *keyTable = ui->tableKeys; + keyTable->setRowCount(10); + keyTable->setColumnCount(3); + keyTable->setColumnHidden(2, true); + keyTable->setColumnWidth(0, 200); + keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + QStringList headers; + headers << "Action" << "Bound key"; + keyTable->setHorizontalHeaderLabels(headers); + keyTable->verticalHeader()->setVisible(false); + keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + keyTable->setSelectionBehavior(QAbstractItemView::SelectRows); + keyTable->setSelectionMode(QAbstractItemView::SingleSelection); + keyTable->setShowGrid(true); + keyTable->setStyleSheet("QTableWidget::item:hover { }"); + keyTable->setFocusPolicy(Qt::NoFocus); + keyTable->setSelectionMode(QAbstractItemView::NoSelection); + + // Make a working copy of acc_keys so we can check for dupes later without getting + // confused + printf("Instantiating list\n"); + for(int x=0;xtableKeys, &QTableWidget::cellDoubleClicked, + this, &SettingsInput::on_tableKeys_doubleClicked); + + connect(ui->pushButtonBind, &QPushButton::clicked, + this, &SettingsInput::on_pushButtonBind_Clicked); + + connect(ui->pushButtonClearBind, &QPushButton::clicked, + this, &SettingsInput::on_pushButtonClearBind_Clicked); + onCurrentMachineChanged(machine); } + SettingsInput::~SettingsInput() { delete ui; @@ -50,8 +106,15 @@ SettingsInput::save() { mouse_type = ui->comboBoxMouse->currentData().toInt(); joystick_type = ui->comboBoxJoystick->currentData().toInt(); + + // Copy accelerators from working set to global set + for(int x=0;xcomboBoxJoystick->setCurrentIndex(selectedRow); } +void +SettingsInput::refreshInputList() +{ + + for (int x=0;xtableKeys->setItem(x, 0, new QTableWidgetItem(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)); + } +} + +void +SettingsInput::on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) +{ + // Enable/disable bind/clear buttons if user clicked valid row + QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1); + if (!cell) + { + ui->pushButtonBind->setEnabled(false); + ui->pushButtonClearBind->setEnabled(false); + } + else + { + ui->pushButtonBind->setEnabled(true); + ui->pushButtonClearBind->setEnabled(true); + } +} + +void +SettingsInput::on_tableKeys_doubleClicked(int row, int col) +{ + // Edit bind + QTableWidgetItem *cell = ui->tableKeys->item(row,1); + if (!cell) return; + + QKeySequence keyseq = KeyBinder::BindKey(cell->text()); + if (keyseq != false) { + // If no change was made, don't change anything. + if (keyseq.toString(QKeySequence::NativeText) == cell->text()) return; + + // Otherwise, check for conflicts. + // Check against the *working* copy - NOT the one in use by the app, + // so we don't test against shortcuts the user already changed. + for(int x=0;xshowMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false); + return; + } + } + // If we made it here, there were no conflicts. + // Go ahead and apply the bind. + + // Find the correct accelerator key entry + int accKeyID = FindAccelerator(qPrintable(ui->tableKeys->item(row,2)->text())); + if (!accKeyID) return; // this should never happen + + // Make the change + cell->setText(keyseq.toString(QKeySequence::NativeText)); + strcpy(acc_keys_t[accKeyID].seq, qPrintable(keyseq.toString(QKeySequence::NativeText))); + + refreshInputList(); + } +} + +void +SettingsInput::on_pushButtonBind_Clicked() +{ + // Edit bind + QTableWidgetItem *cell = ui->tableKeys->currentItem(); + if (!cell) return; + + on_tableKeys_doubleClicked(cell->row(), cell->column()); +} + +void +SettingsInput::on_pushButtonClearBind_Clicked() +{ + // Wipe bind + QTableWidgetItem *cell = ui->tableKeys->currentItem(); + if (!cell) return; + + cell->setText(""); + // Find the correct accelerator key entry + int accKeyID = FindAccelerator(qPrintable(ui->tableKeys->item(cell->row(),2)->text())); + if (!accKeyID) return; // this should never happen + + // Make the change + cell->setText(""); + strcpy(acc_keys_t[accKeyID].seq, ""); +} + void SettingsInput::on_comboBoxMouse_currentIndexChanged(int index) { diff --git a/src/qt/qt_settingsinput.hpp b/src/qt/qt_settingsinput.hpp index 0b8b665aa..ec7dc393b 100644 --- a/src/qt/qt_settingsinput.hpp +++ b/src/qt/qt_settingsinput.hpp @@ -2,6 +2,12 @@ #define QT_SETTINGSINPUT_HPP #include +#include +#include +#include +#include +#include +#include namespace Ui { class SettingsInput; @@ -27,10 +33,15 @@ private slots: void on_pushButtonJoystick2_clicked(); void on_pushButtonJoystick3_clicked(); void on_pushButtonJoystick4_clicked(); + void on_tableKeys_doubleClicked(int row, int col); + void on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + void on_pushButtonBind_Clicked(); + void on_pushButtonClearBind_Clicked(); private: Ui::SettingsInput *ui; int machineId = 0; + void refreshInputList(); }; #endif // QT_SETTINGSINPUT_HPP diff --git a/src/qt/qt_settingsinput.ui b/src/qt/qt_settingsinput.ui index 839461119..b7074eeaa 100644 --- a/src/qt/qt_settingsinput.ui +++ b/src/qt/qt_settingsinput.ui @@ -23,17 +23,16 @@ 0 - - - - Joystick 2... + + + + + 0 + 0 + - - - - - - Joystick: + + 30 @@ -44,13 +43,6 @@ - - - - Mouse: - - - @@ -58,21 +50,15 @@ - - - - Qt::Vertical + + + + false - - QSizePolicy::Expanding + + Bind - - - 20 - 40 - - - + @@ -81,6 +67,44 @@ + + + + 30 + + + + + + + Mouse: + + + + + + + false + + + Clear binding + + + + + + + Joystick: + + + + + + + Joystick 2... + + + @@ -94,23 +118,29 @@ - - - - 30 - - - - 0 - 0 - + + + + Key Bindings: - - - - 30 + + + + QAbstractItemView::EditTrigger::NoEditTriggers + + + false + + + false + + + true + + + QAbstractItemView::SelectionBehavior::SelectRows From f199fa5ce4b4b58ba0b857921b8f492ba3f10faa Mon Sep 17 00:00:00 2001 From: = Date: Sat, 19 Apr 2025 19:50:45 -0700 Subject: [PATCH 02/13] Added new UI files --- src/qt/qt_keybind.cpp | 95 ++++++++++++++++++++++++++++++++++ src/qt/qt_keybind.hpp | 32 ++++++++++++ src/qt/qt_keybind.ui | 85 ++++++++++++++++++++++++++++++ src/qt/qt_singlekeyseqedit.cpp | 20 +++++++ src/qt/qt_singlekeyseqedit.hpp | 16 ++++++ 5 files changed, 248 insertions(+) create mode 100644 src/qt/qt_keybind.cpp create mode 100644 src/qt/qt_keybind.hpp create mode 100644 src/qt/qt_keybind.ui create mode 100644 src/qt/qt_singlekeyseqedit.cpp create mode 100644 src/qt/qt_singlekeyseqedit.hpp diff --git a/src/qt/qt_keybind.cpp b/src/qt/qt_keybind.cpp new file mode 100644 index 000000000..dcfe424d9 --- /dev/null +++ b/src/qt/qt_keybind.cpp @@ -0,0 +1,95 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Device configuration UI code. + * + * + * + * Authors: Joakim L. Gilje + * Cacodemon345 + * + * Copyright 2021 Joakim L. Gilje + * Copyright 2022 Cacodemon345 + */ +#include "qt_keybind.hpp" +#include "ui_qt_keybind.h" +#include "qt_settings.hpp" +#include "qt_singlekeyseqedit.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include <86box/86box.h> +#include <86box/ini.h> +#include <86box/config.h> +#include <86box/device.h> +#include <86box/midi_rtmidi.h> +#include <86box/mem.h> +#include <86box/random.h> +#include <86box/rom.h> +} + +#include "qt_filefield.hpp" +#include "qt_models_common.hpp" +#ifdef Q_OS_LINUX +# include +# include +#endif +#ifdef Q_OS_WINDOWS +#include +#endif + +KeyBinder::KeyBinder(QWidget *parent) + : QDialog(parent) + , ui(new Ui::KeyBinder) +{ + ui->setupUi(this); + singleKeySequenceEdit *seq = new singleKeySequenceEdit(); + ui->formLayout->addRow(seq); + seq->setObjectName("keySequence"); +} + +KeyBinder::~KeyBinder() +{ + delete ui; +} + + +bool KeyBinder::eventFilter(QObject *obj, QEvent *event) +{ + return QObject::eventFilter(obj, event); +} + +QKeySequence +KeyBinder::BindKey(QString CurValue) +{ + KeyBinder kb; + kb.setWindowTitle("Bind Key"); + kb.setFixedSize(kb.minimumSizeHint()); + kb.findChild()->setKeySequence(QKeySequence::fromString(CurValue)); + + if (kb.exec() == QDialog::Accepted) { + QKeySequenceEdit *seq = kb.findChild(); + return (seq->keySequence()); + } else { + return (false); + } +} \ No newline at end of file diff --git a/src/qt/qt_keybind.hpp b/src/qt/qt_keybind.hpp new file mode 100644 index 000000000..afb750794 --- /dev/null +++ b/src/qt/qt_keybind.hpp @@ -0,0 +1,32 @@ +#ifndef QT_KeyBinder_HPP +#define QT_KeyBinder_HPP + +#include + +#include "qt_settings.hpp" + +extern "C" { +struct _device_; +} + +namespace Ui { +class KeyBinder; +} + +class Settings; + +class KeyBinder : public QDialog { + Q_OBJECT + +public: + explicit KeyBinder(QWidget *parent = nullptr); + ~KeyBinder() override; + + static QKeySequence BindKey(QString CurValue); + +private: + Ui::KeyBinder *ui; + bool eventFilter(QObject *obj, QEvent *event); +}; + +#endif // QT_KeyBinder_HPP diff --git a/src/qt/qt_keybind.ui b/src/qt/qt_keybind.ui new file mode 100644 index 000000000..835e12020 --- /dev/null +++ b/src/qt/qt_keybind.ui @@ -0,0 +1,85 @@ + + + KeyBinder + + + + 0 + 0 + 400 + 103 + + + + Dialog + + + + + + + + Enter key combo: + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + + Qt::Orientation::Horizontal + + + + + + + Qt::Orientation::Horizontal + + + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok + + + + + + + + + buttonBox + accepted() + KeyBinder + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + KeyBinder + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/qt/qt_singlekeyseqedit.cpp b/src/qt/qt_singlekeyseqedit.cpp new file mode 100644 index 000000000..f17d2164f --- /dev/null +++ b/src/qt/qt_singlekeyseqedit.cpp @@ -0,0 +1,20 @@ +#include "qt_singlekeyseqedit.hpp" + +/* + This subclass of QKeySequenceEdit restricts the input to only a single + shortcut instead of an unlimited number with a fixed timeout. +*/ + +singleKeySequenceEdit::singleKeySequenceEdit(QWidget *parent) : QKeySequenceEdit(parent) {} + +void singleKeySequenceEdit::keyPressEvent(QKeyEvent *event) +{ + QKeySequenceEdit::keyPressEvent(event); + if (this->keySequence().count() > 0) { + QKeySequenceEdit::setKeySequence(this->keySequence()); + + // This could have unintended consequences since it will happen + // every single time the user presses a key. + emit editingFinished(); + } +} \ No newline at end of file diff --git a/src/qt/qt_singlekeyseqedit.hpp b/src/qt/qt_singlekeyseqedit.hpp new file mode 100644 index 000000000..43ebe70b2 --- /dev/null +++ b/src/qt/qt_singlekeyseqedit.hpp @@ -0,0 +1,16 @@ +#ifndef SINGLEKEYSEQUENCEEDIT_H +#define SINGLEKEYSEQUENCEEDIT_H + +#include +#include + +class singleKeySequenceEdit : public QKeySequenceEdit +{ + Q_OBJECT +public: + singleKeySequenceEdit(QWidget *parent = nullptr); + + void keyPressEvent(QKeyEvent *) override; +}; + +#endif // SINGLEKEYSEQUENCEEDIT_H From 34620f3246c6b31713fd0ced517dd68c2ef8b900 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 19 Apr 2025 20:04:00 -0700 Subject: [PATCH 03/13] Auto-set focus on keybind dialog --- src/config.c | 2 -- src/qt/qt_keybind.cpp | 6 ++++++ src/qt/qt_keybind.hpp | 1 + src/qt/qt_mainwindow.cpp | 1 - src/qt/qt_settingsinput.cpp | 1 - 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index d537711d9..2bea312a9 100644 --- a/src/config.c +++ b/src/config.c @@ -2558,10 +2558,8 @@ save_keybinds(void) for(int x=0;xformLayout->addRow(seq); seq->setObjectName("keySequence"); + this->setTabOrder(seq, ui->buttonBox); } KeyBinder::~KeyBinder() @@ -72,6 +73,11 @@ KeyBinder::~KeyBinder() delete ui; } +void +KeyBinder::showEvent( QShowEvent* event ) { + QWidget::showEvent( event ); + this->findChild()->setFocus(); +} bool KeyBinder::eventFilter(QObject *obj, QEvent *event) { diff --git a/src/qt/qt_keybind.hpp b/src/qt/qt_keybind.hpp index afb750794..e8e7b6e5e 100644 --- a/src/qt/qt_keybind.hpp +++ b/src/qt/qt_keybind.hpp @@ -27,6 +27,7 @@ public: private: Ui::KeyBinder *ui; bool eventFilter(QObject *obj, QEvent *event); + void showEvent( QShowEvent* event ); }; #endif // QT_KeyBinder_HPP diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index ed9bf92a7..9fa38bfb1 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1079,7 +1079,6 @@ MainWindow::on_actionSettings_triggered() case QDialog::Accepted: settings.save(); config_changed = 2; - printf("about to try\n"); updateShortcuts(); pc_reset_hard(); break; diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index 924594083..aa232df67 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -74,7 +74,6 @@ SettingsInput::SettingsInput(QWidget *parent) // Make a working copy of acc_keys so we can check for dupes later without getting // confused - printf("Instantiating list\n"); for(int x=0;x Date: Sat, 19 Apr 2025 20:11:17 -0700 Subject: [PATCH 04/13] Fixed bug in keybind UI --- src/qt/qt_mainwindow.cpp | 1 - src/qt/qt_settingsinput.cpp | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 9fa38bfb1..dc97c6294 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -859,7 +859,6 @@ void MainWindow::updateShortcuts() accID = FindAccelerator("fullscreen"); seq = QKeySequence::fromString(acc_keys[accID].seq); - //printf("shortcut: %s\n", qPrintable(ui->actionFullscreen->shortcut().toString())); ui->actionFullscreen->setShortcut(seq); accID = FindAccelerator("hard_reset"); diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index aa232df67..3be460a4a 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -68,9 +68,6 @@ SettingsInput::SettingsInput(QWidget *parent) keyTable->setSelectionBehavior(QAbstractItemView::SelectRows); keyTable->setSelectionMode(QAbstractItemView::SingleSelection); keyTable->setShowGrid(true); - keyTable->setStyleSheet("QTableWidget::item:hover { }"); - keyTable->setFocusPolicy(Qt::NoFocus); - keyTable->setSelectionMode(QAbstractItemView::NoSelection); // Make a working copy of acc_keys so we can check for dupes later without getting // confused @@ -224,7 +221,7 @@ SettingsInput::on_tableKeys_doubleClicked(int row, int col) // Find the correct accelerator key entry int accKeyID = FindAccelerator(qPrintable(ui->tableKeys->item(row,2)->text())); - if (!accKeyID) return; // this should never happen + if (accKeyID < 0) return; // this should never happen // Make the change cell->setText(keyseq.toString(QKeySequence::NativeText)); @@ -254,7 +251,7 @@ SettingsInput::on_pushButtonClearBind_Clicked() cell->setText(""); // Find the correct accelerator key entry int accKeyID = FindAccelerator(qPrintable(ui->tableKeys->item(cell->row(),2)->text())); - if (!accKeyID) return; // this should never happen + if (accKeyID < 0) return; // this should never happen // Make the change cell->setText(""); From 4c20994d5962c654e13285b524e40468a0cae68b Mon Sep 17 00:00:00 2001 From: = Date: Sat, 19 Apr 2025 23:50:03 -0700 Subject: [PATCH 05/13] Removed broken refs to fix -nix build --- src/config.c | 3 +-- src/include/86box/keyboard.h | 1 - src/unix/unix.c | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/config.c b/src/config.c index 2bea312a9..dcabcd922 100644 --- a/src/config.c +++ b/src/config.c @@ -1807,7 +1807,7 @@ load_keybinds(void) { p = ini_section_get_string(cat, acc_keys[x].name, "none"); // If there's no binding in the file, leave it alone. - if (p != "none") + if (strcmp(p, "none") != 0) { // It would be ideal to validate whether the user entered a // valid combo at this point, but the Qt method for testing that is @@ -2553,7 +2553,6 @@ static void save_keybinds(void) { ini_section_t cat = ini_find_or_create_section(config, "Keybinds"); - char temp[512]; for(int x=0;x Date: Sun, 20 Apr 2025 13:43:14 -0700 Subject: [PATCH 06/13] Merged fullscreen combos. Fixed bug when config file can't be loaded. --- src/86box.c | 30 +++++++++++++++++++++++++ src/config.c | 30 ------------------------- src/include/86box/86box.h | 3 ++- src/qt/qt_mainwindow.cpp | 46 +++++++++++++++++---------------------- 4 files changed, 52 insertions(+), 57 deletions(-) diff --git a/src/86box.c b/src/86box.c index d8c05c8bb..d650b8432 100644 --- a/src/86box.c +++ b/src/86box.c @@ -225,6 +225,28 @@ int other_scsi_present = 0; /* SCSI contro // Accelerator key array struct accelKey acc_keys[NUM_ACCELS]; +// Default accelerator key values +struct accelKey def_acc_keys[NUM_ACCELS] = { + { .name="send_ctrl_alt_del", .desc="Send Control+Alt+Del", + .seq="Ctrl+F12" }, + + { .name="send_ctrl_alt_esc", .desc="Send Control+Alt+Escape", + .seq="Ctrl+F10" }, + + { .name="fullscreen", .desc="Toggle fullscreen", + .seq="Ctrl+Alt+PgUp" }, + + { .name="screenshot", .desc="Screenshot", + .seq="Ctrl+F11" }, + + { .name="release_mouse", .desc="Release mouse pointer", + .seq="Ctrl+End" }, + + { .name="hard_reset", .desc="Hard reset", + .seq="Ctrl+Alt+F12" } +}; + + /* Statistics. */ extern int mmuflush; extern int readlnum; @@ -998,6 +1020,14 @@ usage: gdbstub_init(); + // Initialize the keyboard accelerator list with default values + for(int x=0;x= QT_VERSION_CHECK(6, 0, 0) - windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_PageDown), this); -#else - windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_PageDown), this); -#endif - windowedShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut); - connect(windowedShortcut, &QShortcut::activated, this, [this] () { - if (video_fullscreen) - ui->actionFullscreen->trigger(); - }); - connect(this, &MainWindow::initRendererMonitor, this, &MainWindow::initRendererMonitorSlot); connect(this, &MainWindow::initRendererMonitorForNonQtThread, this, &MainWindow::initRendererMonitorSlot, Qt::BlockingQueuedConnection); connect(this, &MainWindow::destroyRendererMonitor, this, &MainWindow::destroyRendererMonitorSlot); @@ -836,10 +825,11 @@ void MainWindow::updateShortcuts() // Note that the "Release mouse" shortcut is hardcoded elsewhere // This section only applies to shortcuts anchored to UI elements + // First we need to wipe all existing accelerators, otherwise Qt will + // run into conflicts with old ones. ui->actionTake_screenshot->setShortcut(QKeySequence()); ui->actionCtrl_Alt_Del->setShortcut(QKeySequence()); ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence()); - ui->actionFullscreen->setShortcut(QKeySequence()); ui->actionHard_Reset->setShortcut(QKeySequence()); int accID; @@ -857,25 +847,13 @@ void MainWindow::updateShortcuts() seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionCtrl_Alt_Esc->setShortcut(seq); - accID = FindAccelerator("fullscreen"); - seq = QKeySequence::fromString(acc_keys[accID].seq); - ui->actionFullscreen->setShortcut(seq); - accID = FindAccelerator("hard_reset"); seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionHard_Reset->setShortcut(seq); - // To rebind leave_fullscreen we have to disconnect the existing signal, - // build a new shortcut, then connect it. - accID = FindAccelerator("leave_fullscreen"); + accID = FindAccelerator("fullscreen"); seq = QKeySequence::fromString(acc_keys[accID].seq); - disconnect(windowedShortcut,0,0,0); - windowedShortcut = new QShortcut(seq, this); - windowedShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut); - connect(windowedShortcut, &QShortcut::activated, this, [this] () { - if (video_fullscreen) - ui->actionFullscreen->trigger(); - }); + ui->actionFullscreen->setShortcut(seq); } void @@ -1361,6 +1339,20 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) if (event->type() == QEvent::KeyPress) { event->accept(); this->keyPressEvent((QKeyEvent *) event); + + // Detect fullscreen shortcut when menubar is hidden + int accID = FindAccelerator("fullscreen"); + QKeySequence seq = QKeySequence::fromString(acc_keys[accID].seq); + + if (event->type() == QEvent::KeyPress) + { + QKeyEvent *ke = (QKeyEvent *) event; + if ((QKeySequence)(ke->key() | ke->modifiers()) == seq && video_fullscreen != 0) + { + ui->actionFullscreen->trigger(); + } + } + return true; } if (event->type() == QEvent::KeyRelease) { @@ -1380,6 +1372,8 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) plat_pause(curdopause); } } + + return QMainWindow::eventFilter(receiver, event); } From 24a4ed445e3b1805c4f230bdd3b394b85fba0a1d Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 13:59:52 -0700 Subject: [PATCH 07/13] All shortcuts now work in fullscreen --- src/qt/qt_mainwindow.cpp | 45 +++++++++++++++++++++++++++++++++------- src/qt/qt_mainwindow.hpp | 2 ++ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index e57c7b96f..2b3eda4af 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1325,6 +1325,19 @@ MainWindow::getTitle(wchar_t *title) } } + +// Helper to find an accelerator key and return it's sequence +// TODO: Is there a more central place to put this? +QKeySequence +MainWindow::FindAcceleratorSeq(const char *name) +{ + int accID = FindAccelerator(name); + if(accID == -1) + return false; + + return(QKeySequence::fromString(acc_keys[accID].seq)); +} + bool MainWindow::eventFilter(QObject *receiver, QEvent *event) { @@ -1337,22 +1350,40 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) } } if (event->type() == QEvent::KeyPress) { - event->accept(); this->keyPressEvent((QKeyEvent *) event); - // Detect fullscreen shortcut when menubar is hidden - int accID = FindAccelerator("fullscreen"); - QKeySequence seq = QKeySequence::fromString(acc_keys[accID].seq); + // Detect shortcuts when menubar is hidden + // TODO: Could this be simplified by proxying the event and manually + // shoving it into the menubar? + QKeySequence accKey; - if (event->type() == QEvent::KeyPress) + if (event->type() == QEvent::KeyPress && video_fullscreen != 0) { QKeyEvent *ke = (QKeyEvent *) event; - if ((QKeySequence)(ke->key() | ke->modifiers()) == seq && video_fullscreen != 0) + + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("screenshot")) { - ui->actionFullscreen->trigger(); + ui->actionTake_screenshot->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_del")) + { + ui->actionCtrl_Alt_Del->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_esc")) + { + ui->actionCtrl_Alt_Esc->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("hard_reset")) + { + ui->actionHard_Reset->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("fullscreen")) + { + ui->actionFullscreen->trigger(); } } + event->accept(); return true; } if (event->type() == QEvent::KeyRelease) { diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 99b0021c2..5811ac36a 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -34,6 +34,8 @@ public: void setSendKeyboardInput(bool enabled); void reloadAllRenderers(); QShortcut *windowedShortcut; + QKeySequence FindAcceleratorSeq(const char *name); + std::array, 8> renderers; signals: From 9febdd1510346744e0edc114054a92353117acb2 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 14:28:10 -0700 Subject: [PATCH 08/13] Added pause shortcut. --- src/86box.c | 5 +- src/include/86box/86box.h | 2 +- src/qt/qt_mainwindow.cpp | 105 ++++++++++++++++++++++---------------- 3 files changed, 66 insertions(+), 46 deletions(-) diff --git a/src/86box.c b/src/86box.c index d650b8432..e3d1e785c 100644 --- a/src/86box.c +++ b/src/86box.c @@ -243,7 +243,10 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { .seq="Ctrl+End" }, { .name="hard_reset", .desc="Hard reset", - .seq="Ctrl+Alt+F12" } + .seq="Ctrl+Alt+F12" }, + + { .name="pause", .desc="Toggle pause", + .seq="Ctrl+Alt+F1" } }; diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 4dcd521e0..51f1dbcbc 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -242,7 +242,7 @@ struct accelKey { char desc[64]; char seq[64]; }; -#define NUM_ACCELS 6 +#define NUM_ACCELS 7 extern struct accelKey acc_keys[NUM_ACCELS]; extern struct accelKey def_acc_keys[NUM_ACCELS]; extern int FindAccelerator(const char *name); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 2b3eda4af..ad1c0e2a0 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -821,9 +821,13 @@ MainWindow::closeEvent(QCloseEvent *event) 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 + /* + 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 + */ // First we need to wipe all existing accelerators, otherwise Qt will // run into conflicts with old ones. @@ -831,6 +835,7 @@ void MainWindow::updateShortcuts() ui->actionCtrl_Alt_Del->setShortcut(QKeySequence()); ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence()); ui->actionHard_Reset->setShortcut(QKeySequence()); + ui->actionPause->setShortcut(QKeySequence()); int accID; QKeySequence seq; @@ -854,6 +859,10 @@ void MainWindow::updateShortcuts() accID = FindAccelerator("fullscreen"); seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionFullscreen->setShortcut(seq); + + accID = FindAccelerator("pause"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionPause->setShortcut(seq); } void @@ -1341,6 +1350,54 @@ MainWindow::FindAcceleratorSeq(const char *name) bool MainWindow::eventFilter(QObject *receiver, QEvent *event) { + // Detect shortcuts when menubar is hidden + // TODO: Could this be simplified by proxying the event and manually + // shoving it into the menubar? + + // Note: This section should ONLY contain shortcuts that are valid + // when the emulator + if (event->type() == QEvent::KeyPress) + { + this->keyPressEvent((QKeyEvent *) event); + + 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(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("fullscreen")) + { + ui->actionFullscreen->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("hard_reset")) + { + ui->actionHard_Reset->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_del")) + { + ui->actionCtrl_Alt_Del->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_esc")) + { + ui->actionCtrl_Alt_Esc->trigger(); + } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("pause")) + { + ui->actionPause->trigger(); + } + return true; + } + } + + if (!dopause) { if (event->type() == QEvent::Shortcut) { auto shortcutEvent = (QShortcutEvent *) event; @@ -1350,40 +1407,8 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) } } if (event->type() == QEvent::KeyPress) { - this->keyPressEvent((QKeyEvent *) event); - - // Detect shortcuts when menubar is hidden - // TODO: Could this be simplified by proxying the event and manually - // shoving it into the menubar? - QKeySequence accKey; - - if (event->type() == QEvent::KeyPress && video_fullscreen != 0) - { - QKeyEvent *ke = (QKeyEvent *) event; - - if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("screenshot")) - { - ui->actionTake_screenshot->trigger(); - } - if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_del")) - { - ui->actionCtrl_Alt_Del->trigger(); - } - if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_esc")) - { - ui->actionCtrl_Alt_Esc->trigger(); - } - if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("hard_reset")) - { - ui->actionHard_Reset->trigger(); - } - if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("fullscreen")) - { - ui->actionFullscreen->trigger(); - } - } - event->accept(); + return true; } if (event->type() == QEvent::KeyRelease) { @@ -1471,14 +1496,6 @@ MainWindow::keyPressEvent(QKeyEvent *event) processKeyboardInput(true, event->nativeScanCode()); #endif } - - // Check if mouse release combo has been entered - int accID = FindAccelerator("release_mouse"); - QKeySequence seq = QKeySequence::fromString(acc_keys[accID].seq); - if (seq[0] == (event->key() | event->modifiers())) - plat_mouse_capture(0); - - // TODO: Other accelerators should probably be here? event->accept(); } From fd235bcf9630eff939ccab2604a046e3b5510785 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 14:31:46 -0700 Subject: [PATCH 09/13] Added pause shortcut. --- src/86box.c | 5 ++++- src/qt/qt_mainwindow.cpp | 15 ++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/86box.c b/src/86box.c index e3d1e785c..dae2d4ba5 100644 --- a/src/86box.c +++ b/src/86box.c @@ -246,7 +246,10 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { .seq="Ctrl+Alt+F12" }, { .name="pause", .desc="Toggle pause", - .seq="Ctrl+Alt+F1" } + .seq="Ctrl+Alt+F1" }, + + { .name="mute", .desc="Toggle mute", + .seq="Ctrl+Alt+M" } }; diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index ad1c0e2a0..27124b9fd 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -836,6 +836,7 @@ void MainWindow::updateShortcuts() ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence()); ui->actionHard_Reset->setShortcut(QKeySequence()); ui->actionPause->setShortcut(QKeySequence()); + ui->actionMute_Unmute->setShortcut(QKeySequence()); int accID; QKeySequence seq; @@ -863,6 +864,10 @@ void MainWindow::updateShortcuts() accID = FindAccelerator("pause"); seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionPause->setShortcut(seq); + + accID = FindAccelerator("mute"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionMute_Unmute->setShortcut(seq); } void @@ -1353,9 +1358,6 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) // Detect shortcuts when menubar is hidden // TODO: Could this be simplified by proxying the event and manually // shoving it into the menubar? - - // Note: This section should ONLY contain shortcuts that are valid - // when the emulator if (event->type() == QEvent::KeyPress) { this->keyPressEvent((QKeyEvent *) event); @@ -1393,6 +1395,11 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) { ui->actionPause->trigger(); } + if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("mute")) + { + ui->actionMute_Unmute->setShortcut(seq); + } + return true; } } @@ -1429,8 +1436,6 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) } } - - return QMainWindow::eventFilter(receiver, event); } From eaff1fcd703a08b846e0fc6e6efe08e670b5c6ae Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 14:33:19 -0700 Subject: [PATCH 10/13] Added mute shortcut. --- src/include/86box/86box.h | 2 +- src/qt/qt_mainwindow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 51f1dbcbc..7f7723bba 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -242,7 +242,7 @@ struct accelKey { char desc[64]; char seq[64]; }; -#define NUM_ACCELS 7 +#define NUM_ACCELS 8 extern struct accelKey acc_keys[NUM_ACCELS]; extern struct accelKey def_acc_keys[NUM_ACCELS]; extern int FindAccelerator(const char *name); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 27124b9fd..568c84b36 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1397,7 +1397,7 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) } if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("mute")) { - ui->actionMute_Unmute->setShortcut(seq); + ui->actionMute_Unmute->trigger(); } return true; From 505874f22ee33691a54774487f273d775edc0336 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 15:23:38 -0700 Subject: [PATCH 11/13] Added translation to key shortcut table, modals, and release mouse status line. --- src/qt/languages/fr-FR.po | 8 ++++---- src/qt/qt_mainwindow.cpp | 26 +++++++++++++++++--------- src/qt/qt_platform.cpp | 10 ++++++++-- src/qt/qt_settingsinput.cpp | 9 +++++---- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 8456baf2f..5416f7662 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -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" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 568c84b36..d79cc1b9e 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -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(); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 0f792feda..26682528d 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -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(); diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index 3be460a4a..20cb40ecd 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -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;xtableKeys->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)); } From d6b280dd29eb066fcf48c3b1df1d813dd290736e Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 15:29:15 -0700 Subject: [PATCH 12/13] Status line now updates --- src/qt/qt_settingsinput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index 20cb40ecd..f87296451 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -17,6 +17,7 @@ #include "qt_settingsinput.hpp" #include "ui_qt_settingsinput.h" #include "qt_mainwindow.hpp" +#include "qt_progsettings.hpp" #include #include @@ -109,7 +110,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(); + ProgSettings::reloadStrings(); } void From 30ea1eb08752cf6332b1c48a924aa7daeb80dc7e Mon Sep 17 00:00:00 2001 From: = Date: Sun, 20 Apr 2025 15:36:49 -0700 Subject: [PATCH 13/13] Updated translations --- src/qt/languages/ca-ES.po | 12 ++++++------ src/qt/languages/cs-CZ.po | 12 ++++++------ src/qt/languages/de-DE.po | 12 ++++++------ src/qt/languages/es-ES.po | 12 ++++++------ src/qt/languages/fi-FI.po | 12 ++++++------ src/qt/languages/fr-FR.po | 4 ++-- src/qt/languages/hr-HR.po | 12 ++++++------ src/qt/languages/hu-HU.po | 12 ++++++------ src/qt/languages/it-IT.po | 12 ++++++------ src/qt/languages/ja-JP.po | 12 ++++++------ src/qt/languages/ko-KR.po | 12 ++++++------ src/qt/languages/nl-NL.po | 12 ++++++------ src/qt/languages/pl-PL.po | 12 ++++++------ src/qt/languages/pt-BR.po | 12 ++++++------ src/qt/languages/pt-PT.po | 12 ++++++------ src/qt/languages/ru-RU.po | 12 ++++++------ src/qt/languages/sk-SK.po | 12 ++++++------ src/qt/languages/sl-SI.po | 12 ++++++------ src/qt/languages/sv-SE.po | 12 ++++++------ src/qt/languages/tr-TR.po | 12 ++++++------ src/qt/languages/uk-UA.po | 12 ++++++------ src/qt/languages/vi-VN.po | 12 ++++++------ src/qt/languages/zh-CN.po | 8 ++++---- src/qt/languages/zh-TW.po | 8 ++++---- src/qt/qt_mainwindow.cpp | 2 +- 25 files changed, 137 insertions(+), 137 deletions(-) diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index 847cc0138..4851106cd 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -630,8 +630,8 @@ msgstr "Error fatal" msgid " - PAUSED" msgstr " - EN PAUSA" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Premeu Ctrl+Alt+PgDn per tornar al mode de finestra." +msgid "Press %s to return to windowed mode." +msgstr "Premeu %s per tornar al mode de finestra." msgid "Speed" msgstr "Velocitat" @@ -717,11 +717,11 @@ msgstr "Altres perifèrics" msgid "Click to capture mouse" msgstr "Feu clic per capturar el ratolí" -msgid "Press %1 to release mouse" -msgstr "Premeu %1 per alliberar el ratolí" +msgid "Press %s to release mouse" +msgstr "Premeu %s per alliberar el ratolí" -msgid "Press %1 or middle button to release mouse" -msgstr "Premeu %1 o el botó central per alliberar el ratolí" +msgid "Press %s or middle button to release mouse" +msgstr "Premeu %s o el botó central per alliberar el ratolí" msgid "Bus" msgstr "Bus" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index ea492f0b6..352fafc31 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -630,8 +630,8 @@ msgstr "Kritická chyba" msgid " - PAUSED" msgstr " - POZASTAVENO" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Stiskněte Ctrl+Alt+PgDn pro návrat z režimu celé obrazovky." +msgid "Press %s to return to windowed mode." +msgstr "Stiskněte %s pro návrat z režimu celé obrazovky." msgid "Speed" msgstr "Rychlost" @@ -717,11 +717,11 @@ msgstr "Jiné příslušenství" msgid "Click to capture mouse" msgstr "Klikněte pro zabraní myši" -msgid "Press %1 to release mouse" -msgstr "Stiskněte %1 pro uvolnění myši" +msgid "Press %s to release mouse" +msgstr "Stiskněte %s pro uvolnění myši" -msgid "Press %1 or middle button to release mouse" -msgstr "Stiskněte %1 nebo prostřední tlačítko pro uvolnění myši" +msgid "Press %s or middle button to release mouse" +msgstr "Stiskněte %s nebo prostřední tlačítko pro uvolnění myši" msgid "Bus" msgstr "Sběrnice" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 95d1b0249..ce7d52d55 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -630,8 +630,8 @@ msgstr "Fataler Fehler" msgid " - PAUSED" msgstr " - PAUSIERT" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Strg+Alt+Bild ab, zur Rückkehr in den Fenstermodus." +msgid "Press %s to return to windowed mode." +msgstr "%s ab, zur Rückkehr in den Fenstermodus." msgid "Speed" msgstr "Geschwindigkeit" @@ -717,11 +717,11 @@ msgstr "Andere Peripheriegeräte" msgid "Click to capture mouse" msgstr "Klicken zum Einfangen des Mauszeigers" -msgid "Press %1 to release mouse" -msgstr "Drücke %1 zur Mausfreigabe" +msgid "Press %s to release mouse" +msgstr "Drücke %s zur Mausfreigabe" -msgid "Press %1 or middle button to release mouse" -msgstr "Drücke %1 oder die mittlere Maustaste zur Mausfreigabe" +msgid "Press %s or middle button to release mouse" +msgstr "Drücke %s oder die mittlere Maustaste zur Mausfreigabe" msgid "Ctrl+End" msgstr "Strg+Ende" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 57474ae53..177d08d18 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -630,8 +630,8 @@ msgstr "Error fatal" msgid " - PAUSED" msgstr " - EN PAUSA" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Pulsa Ctrl+Alt+PgDn para volver a modo ventana." +msgid "Press %s to return to windowed mode." +msgstr "Pulsa %s para volver a modo ventana." msgid "Speed" msgstr "Velocidad" @@ -717,11 +717,11 @@ msgstr "Otros periféricos" msgid "Click to capture mouse" msgstr "Haga click para capturar el ratón" -msgid "Press %1 to release mouse" -msgstr "Pulse %1 para liberar el ratón" +msgid "Press %s to release mouse" +msgstr "Pulse %s para liberar el ratón" -msgid "Press %1 or middle button to release mouse" -msgstr "Pulse %1 o el botón central para liberar el ratón" +msgid "Press %s or middle button to release mouse" +msgstr "Pulse %s o el botón central para liberar el ratón" msgid "Bus" msgstr "Bus" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 187a423f6..a77b3f6ef 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -630,8 +630,8 @@ msgstr "Vakava virhe" msgid " - PAUSED" msgstr " - TAUKO" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Paina Ctrl+Alt+PgDn palataksesi ikkunoituun tilaan." +msgid "Press %s to return to windowed mode." +msgstr "Paina %s palataksesi ikkunoituun tilaan." msgid "Speed" msgstr "Nopeus" @@ -717,11 +717,11 @@ msgstr "Muut oheislaitteet" msgid "Click to capture mouse" msgstr "Kaappaa hiiri klikkaamalla" -msgid "Press %1 to release mouse" -msgstr "Paina %1 vapauttaaksesi hiiren" +msgid "Press %s to release mouse" +msgstr "Paina %s vapauttaaksesi hiiren" -msgid "Press %1 or middle button to release mouse" -msgstr "Paina %1 tai keskipainiketta vapauttaaksesi hiiren" +msgid "Press %s or middle button to release mouse" +msgstr "Paina %s tai keskipainiketta vapauttaaksesi hiiren" msgid "Bus" msgstr "Väylä" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 5416f7662..fe3dc4bb4 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -630,8 +630,8 @@ msgstr "Erreur fatale" msgid " - PAUSED" msgstr " - EN PAUSE" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Appuyez sur Ctrl+Alt+PgDn pour revenir au mode fenêtré." +msgid "Press %s to return to windowed mode." +msgstr "Appuyez sur %s pour revenir au mode fenêtré." msgid "Speed" msgstr "Vitesse" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 0fd342f88..1eecaa2d0 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -630,8 +630,8 @@ msgstr "Fatalna greška" msgid " - PAUSED" msgstr " - ZASTAO" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Pritisnite Ctrl+Alt+PgDn za povratak u prozorski način rada." +msgid "Press %s to return to windowed mode." +msgstr "Pritisnite %s za povratak u prozorski način rada." msgid "Speed" msgstr "Brzina" @@ -717,11 +717,11 @@ msgstr "Ostali periferni uređaji" msgid "Click to capture mouse" msgstr "Kliknite da uhvatite miš" -msgid "Press %1 to release mouse" -msgstr "Pritisnite %1 za otpustanje miša" +msgid "Press %s to release mouse" +msgstr "Pritisnite %s za otpustanje miša" -msgid "Press %1 or middle button to release mouse" -msgstr "Pritisnite %1 ili srednji gumb miša za otpuštanje miša" +msgid "Press %s or middle button to release mouse" +msgstr "Pritisnite %s ili srednji gumb miša za otpuštanje miša" msgid "Bus" msgstr "Bus" diff --git a/src/qt/languages/hu-HU.po b/src/qt/languages/hu-HU.po index cbb753890..43a1fd9ba 100644 --- a/src/qt/languages/hu-HU.po +++ b/src/qt/languages/hu-HU.po @@ -630,8 +630,8 @@ msgstr "Végzetes hiba" msgid " - PAUSED" msgstr " - SZÜNETELT" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Használja a Ctrl+Alt+PgDn gombokat az ablakhoz való visszatéréshez." +msgid "Press %s to return to windowed mode." +msgstr "Használja a %s gombokat az ablakhoz való visszatéréshez." msgid "Speed" msgstr "Sebesség" @@ -717,11 +717,11 @@ msgstr "Egyéb perifériák" msgid "Click to capture mouse" msgstr "Kattintson az egér elfogásához" -msgid "Press %1 to release mouse" -msgstr "Nyomja meg az %1-t az egér elengédéséhez" +msgid "Press %s to release mouse" +msgstr "Nyomja meg az %s-t az egér elengédéséhez" -msgid "Press %1 or middle button to release mouse" -msgstr "Nyomja meg az %1-t vagy a középső gombot az egér elengédéséhez" +msgid "Press %s or middle button to release mouse" +msgstr "Nyomja meg az %s-t vagy a középső gombot az egér elengédéséhez" msgid "Bus" msgstr "Busz" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index c505b9eaa..b8ded74de 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -630,8 +630,8 @@ msgstr "Errore fatale" msgid " - PAUSED" msgstr " - IN PAUSA" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Usa Ctrl+Alt+PgDn per tornare alla modalità finestra." +msgid "Press %s to return to windowed mode." +msgstr "Usa %s per tornare alla modalità finestra." msgid "Speed" msgstr "Velocità" @@ -717,11 +717,11 @@ msgstr "Altre periferiche" msgid "Click to capture mouse" msgstr "Fare clic per catturare mouse" -msgid "Press %1 to release mouse" -msgstr "Premi %1 per rilasciare il mouse" +msgid "Press %s to release mouse" +msgstr "Premi %s per rilasciare il mouse" -msgid "Press %1 or middle button to release mouse" -msgstr "Premi %1 o pulsante centrale per rilasciare il mouse" +msgid "Press %s or middle button to release mouse" +msgstr "Premi %s o pulsante centrale per rilasciare il mouse" msgid "Bus" msgstr "Bus" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index cff667239..dc000b175 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -630,8 +630,8 @@ msgstr "致命的なエラー" msgid " - PAUSED" msgstr " - 一時停止" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Ctrl+Alt+PgDnでウィンドウ モードに戻ります。" +msgid "Press %s to return to windowed mode." +msgstr "%sでウィンドウ モードに戻ります。" msgid "Speed" msgstr "速度" @@ -717,11 +717,11 @@ msgstr "他の周辺デバイス" msgid "Click to capture mouse" msgstr "左クリックでマウスをキャプチャします" -msgid "Press %1 to release mouse" -msgstr "%1キーでマウスを解放します" +msgid "Press %s to release mouse" +msgstr "%sキーでマウスを解放します" -msgid "Press %1 or middle button to release mouse" -msgstr "%1キーまたは中クリックでマウスを解放します" +msgid "Press %s or middle button to release mouse" +msgstr "%sキーまたは中クリックでマウスを解放します" msgid "Bus" msgstr "バス" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 55f47be27..3ef901789 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -630,8 +630,8 @@ msgstr "치명적인 오류" msgid " - PAUSED" msgstr " - 일시 중지됨" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Ctrl+Alt+PgDn 키를 누르면 창 모드로 전환합니다." +msgid "Press %s to return to windowed mode." +msgstr "%s 키를 누르면 창 모드로 전환합니다." msgid "Speed" msgstr "속도" @@ -717,11 +717,11 @@ msgstr "기타 주변기기" msgid "Click to capture mouse" msgstr "이 창을 클릭하면 마우스를 사용합니다" -msgid "Press %1 to release mouse" -msgstr "%1키를 누르면 마우스를 해제합니다" +msgid "Press %s to release mouse" +msgstr "%s키를 누르면 마우스를 해제합니다" -msgid "Press %1 or middle button to release mouse" -msgstr "%1키 또는 가운데 버튼을 클릭하면 마우스를 해제합니다" +msgid "Press %s or middle button to release mouse" +msgstr "%s키 또는 가운데 버튼을 클릭하면 마우스를 해제합니다" msgid "Bus" msgstr "버스" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index e854ea3f3..8ee391957 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -630,8 +630,8 @@ msgstr "Fatale fout" msgid " - PAUSED" msgstr " - GEPAUZEERD" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Druk op Ctrl+Alt+PgDn om terug te gaan naar de venstermodus." +msgid "Press %s to return to windowed mode." +msgstr "Druk op %s om terug te gaan naar de venstermodus." msgid "Speed" msgstr "Snelheid" @@ -717,11 +717,11 @@ msgstr "Andere randapparatuur" msgid "Click to capture mouse" msgstr "Klik om muis vast te leggen" -msgid "Press %1 to release mouse" -msgstr "Druk op %1 om de muis los te laten" +msgid "Press %s to release mouse" +msgstr "Druk op %s om de muis los te laten" -msgid "Press %1 or middle button to release mouse" -msgstr "Druk op %1 of middelste knop om de muis los te laten" +msgid "Press %s or middle button to release mouse" +msgstr "Druk op %s of middelste knop om de muis los te laten" msgid "Bus" msgstr "Bus" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 3fc731e5f..d5b5ec3ea 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -630,8 +630,8 @@ msgstr "Fatalny błąd" msgid " - PAUSED" msgstr " - PAUSED" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Naciśnij klawisze Ctrl+Alt+PgDn aby wrócić to trybu okna." +msgid "Press %s to return to windowed mode." +msgstr "Naciśnij klawisze %s aby wrócić to trybu okna." msgid "Speed" msgstr "Szybkość" @@ -717,11 +717,11 @@ msgstr "Inne urządzenia peryferyjne" msgid "Click to capture mouse" msgstr "Kliknij w celu przechwycenia myszy" -msgid "Press %1 to release mouse" -msgstr "Naciśnij klawisze %1 w celu uwolnienia myszy" +msgid "Press %s to release mouse" +msgstr "Naciśnij klawisze %s w celu uwolnienia myszy" -msgid "Press %1 or middle button to release mouse" -msgstr "Naciśnij klawisze %1 lub środkowy przycisk w celu uwolnienia myszy" +msgid "Press %s or middle button to release mouse" +msgstr "Naciśnij klawisze %s lub środkowy przycisk w celu uwolnienia myszy" msgid "Bus" msgstr "Magistrala" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 02abe2321..8961f11b8 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -630,8 +630,8 @@ msgstr "Erro fatal" msgid " - PAUSED" msgstr " - PAUSADO" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Use Ctrl+Alt+PgDn para retornar ao modo janela" +msgid "Press %s to return to windowed mode." +msgstr "Use %s para retornar ao modo janela" msgid "Speed" msgstr "Velocidade" @@ -717,11 +717,11 @@ msgstr "Outros periféricos" msgid "Click to capture mouse" msgstr "Clique para capturar o mouse" -msgid "Press %1 to release mouse" -msgstr "Aperte %1 para liberar o mouse" +msgid "Press %s to release mouse" +msgstr "Aperte %s para liberar o mouse" -msgid "Press %1 or middle button to release mouse" -msgstr "Aperte %1 ou botão do meio para liberar o mouse" +msgid "Press %s or middle button to release mouse" +msgstr "Aperte %s ou botão do meio para liberar o mouse" msgid "Bus" msgstr "Barramento" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 42550a266..ba1c6976c 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -630,8 +630,8 @@ msgstr "Erro fatal" msgid " - PAUSED" msgstr " - EM PAUSA" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Pressione Ctrl+Alt+PgDn para voltar ao modo de janela." +msgid "Press %s to return to windowed mode." +msgstr "Pressione %s para voltar ao modo de janela." msgid "Speed" msgstr "Velocidade" @@ -717,11 +717,11 @@ msgstr "Outros dispositivos" msgid "Click to capture mouse" msgstr "Clique para capturar o rato" -msgid "Press %1 to release mouse" -msgstr "Pressione %1 para soltar o rato" +msgid "Press %s to release mouse" +msgstr "Pressione %s para soltar o rato" -msgid "Press %1 or middle button to release mouse" -msgstr "Pressione %1 ou tecla média para soltar o rato" +msgid "Press %s or middle button to release mouse" +msgstr "Pressione %s ou tecla média para soltar o rato" msgid "Bus" msgstr "Barramento" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index dde5387a7..baf1035ea 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -630,8 +630,8 @@ msgstr "Неустранимая ошибка" msgid " - PAUSED" msgstr " - ПАУЗА" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Нажмите Ctrl+Alt+PgDn для возврата в оконный режим." +msgid "Press %s to return to windowed mode." +msgstr "Нажмите %s для возврата в оконный режим." msgid "Speed" msgstr "Скорость" @@ -717,11 +717,11 @@ msgstr "Другая периферия" msgid "Click to capture mouse" msgstr "Щёлкните мышью для захвата курсора" -msgid "Press %1 to release mouse" -msgstr "Нажмите %1, чтобы освободить курсор" +msgid "Press %s to release mouse" +msgstr "Нажмите %s, чтобы освободить курсор" -msgid "Press %1 or middle button to release mouse" -msgstr "Нажмите %1 или среднюю кнопку мыши, чтобы освободить курсор" +msgid "Press %s or middle button to release mouse" +msgstr "Нажмите %s или среднюю кнопку мыши, чтобы освободить курсор" msgid "Bus" msgstr "Шина" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 6039adedc..f11f335d4 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -630,8 +630,8 @@ msgstr "Kritická chyba" msgid " - PAUSED" msgstr " - POZASTAVENÝ" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Stlačte Ctrl+Alt+PgDn pre návrat z režimu celej obrazovky." +msgid "Press %s to return to windowed mode." +msgstr "Stlačte %s pre návrat z režimu celej obrazovky." msgid "Speed" msgstr "Rýchlosť" @@ -717,11 +717,11 @@ msgstr "Iné príslušenstvo" msgid "Click to capture mouse" msgstr "Kliknite pre zabráni myši" -msgid "Press %1 to release mouse" -msgstr "Stlačte %1 pre uvoľnenie myši" +msgid "Press %s to release mouse" +msgstr "Stlačte %s pre uvoľnenie myši" -msgid "Press %1 or middle button to release mouse" -msgstr "Stlačte %1 alebo prostredné tlačidlo na uvoľnenie myši" +msgid "Press %s or middle button to release mouse" +msgstr "Stlačte %s alebo prostredné tlačidlo na uvoľnenie myši" msgid "Bus" msgstr "Zbernica" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index b6641f8a1..7c2b36650 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -630,8 +630,8 @@ msgstr "Kritična napaka" msgid " - PAUSED" msgstr " - ZAUSTAVLJEN" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Pritisnite Ctrl+Alt+PgDn za povratek iz celozaslonskega načina." +msgid "Press %s to return to windowed mode." +msgstr "Pritisnite %s za povratek iz celozaslonskega načina." msgid "Speed" msgstr "Hitrost" @@ -717,11 +717,11 @@ msgstr "Druga periferija" msgid "Click to capture mouse" msgstr "Kliknite za zajem miške" -msgid "Press %1 to release mouse" -msgstr "Pritisnite %1 za izpust miške" +msgid "Press %s to release mouse" +msgstr "Pritisnite %s za izpust miške" -msgid "Press %1 or middle button to release mouse" -msgstr "Pritisnite %1 ali srednji gumb za izpust miške" +msgid "Press %s or middle button to release mouse" +msgstr "Pritisnite %s ali srednji gumb za izpust miške" msgid "Bus" msgstr "Vodilo" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index a47997225..61152c663 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -630,8 +630,8 @@ msgstr "Allvarligt fel" msgid " - PAUSED" msgstr " - PAUSAD" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Tryck på Ctrl+Alt+PgDn för att återvända till fönsterläge." +msgid "Press %s to return to windowed mode." +msgstr "Tryck på %s för att återvända till fönsterläge." msgid "Speed" msgstr "Hastighet" @@ -717,11 +717,11 @@ msgstr "Andra tillbehör" msgid "Click to capture mouse" msgstr "Klicka för att fånga upp musen" -msgid "Press %1 to release mouse" -msgstr "Tryck på %1 för att släppa musen" +msgid "Press %s to release mouse" +msgstr "Tryck på %s för att släppa musen" -msgid "Press %1 or middle button to release mouse" -msgstr "Tryck på %1 eller mellersta musknappen för att släppa musen" +msgid "Press %s or middle button to release mouse" +msgstr "Tryck på %s eller mellersta musknappen för att släppa musen" msgid "Bus" msgstr "Buss" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index e9a42a896..de111c59b 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -630,8 +630,8 @@ msgstr "Kritik hata" msgid " - PAUSED" msgstr " - DURAKLATILDI" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Pencere moduna geri dönmek için Ctrl+Alt+PgDn tuşlarına basın." +msgid "Press %s to return to windowed mode." +msgstr "Pencere moduna geri dönmek için %s tuşlarına basın." msgid "Speed" msgstr "Hız" @@ -717,11 +717,11 @@ msgstr "Diğer cihazlar" msgid "Click to capture mouse" msgstr "Farenin yakalanması için tıklayın" -msgid "Press %1 to release mouse" -msgstr "Farenin bırakılması için %1 tuşlarına basın" +msgid "Press %s to release mouse" +msgstr "Farenin bırakılması için %s tuşlarına basın" -msgid "Press %1 or middle button to release mouse" -msgstr "Farenin bırakılması için %1 tuşlarına veya tekerlek tuşuna basın" +msgid "Press %s or middle button to release mouse" +msgstr "Farenin bırakılması için %s tuşlarına veya tekerlek tuşuna basın" msgid "Bus" msgstr "Veri yolu" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index bceb7bea5..db9b73491 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -630,8 +630,8 @@ msgstr "Непереробна помилка" msgid " - PAUSED" msgstr " - ПРИЗУПИНЕННЯ" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Натисніть Ctrl+Alt+PgDn для повернення у віконний режим." +msgid "Press %s to return to windowed mode." +msgstr "Натисніть %s для повернення у віконний режим." msgid "Speed" msgstr "Швидкість" @@ -717,11 +717,11 @@ msgstr "Інша периферія" msgid "Click to capture mouse" msgstr "Клацніть мишею для захвату курсора" -msgid "Press %1 to release mouse" -msgstr "Натисніть %1, щоб звільнити курсор" +msgid "Press %s to release mouse" +msgstr "Натисніть %s, щоб звільнити курсор" -msgid "Press %1 or middle button to release mouse" -msgstr "Натисніть %1 або середню кнопку миші, щоб звільнити курсор" +msgid "Press %s or middle button to release mouse" +msgstr "Натисніть %s або середню кнопку миші, щоб звільнити курсор" msgid "Bus" msgstr "Шина" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index e14386bf8..e21466a18 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -630,8 +630,8 @@ msgstr "Lỗi nghiêm trọng" msgid " - PAUSED" msgstr " - TẠM DỪNG" -msgid "Press Ctrl+Alt+PgDn to return to windowed mode." -msgstr "Bấm Ctrl+Alt+PgDn để quay lại chế độ cửa sổ." +msgid "Press %s to return to windowed mode." +msgstr "Bấm %s để quay lại chế độ cửa sổ." msgid "Speed" msgstr "Vận tốc" @@ -717,11 +717,11 @@ msgstr "Thiết bị ngoại vi khác" msgid "Click to capture mouse" msgstr "Nhấp vào khung hình để 'nhốt' chuột vào" -msgid "Press %1 to release mouse" -msgstr "Nhấn %1 để thả chuột" +msgid "Press %s to release mouse" +msgstr "Nhấn %s để thả chuột" -msgid "Press %1 or middle button to release mouse" -msgstr "Nhấn %1 hoặc nhấp chuột giữa để thả chuột" +msgid "Press %s or middle button to release mouse" +msgstr "Nhấn %s hoặc nhấp chuột giữa để thả chuột" msgid "Bus" msgstr "Bus" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 9f6cc0328..c29e40dfb 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -717,11 +717,11 @@ msgstr "其他外围设备" msgid "Click to capture mouse" msgstr "单击窗口捕捉鼠标" -msgid "Press %1 to release mouse" -msgstr "按下 %1 释放鼠标" +msgid "Press %s to release mouse" +msgstr "按下 %s 释放鼠标" -msgid "Press %1 or middle button to release mouse" -msgstr "按下 %1 或鼠标中键释放鼠标" +msgid "Press %s or middle button to release mouse" +msgstr "按下 %s 或鼠标中键释放鼠标" msgid "Bus" msgstr "总线" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index aefa89d5f..7de6f8cd3 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -717,11 +717,11 @@ msgstr "其他周邊裝置" msgid "Click to capture mouse" msgstr "點擊視窗捕捉滑鼠" -msgid "Press %1 to release mouse" -msgstr "按下 %1 釋放滑鼠" +msgid "Press %s to release mouse" +msgstr "按下 %s 釋放滑鼠" -msgid "Press %1 or middle button to release mouse" -msgstr "按下 %1 或滑鼠中鍵釋放滑鼠" +msgid "Press %s or middle button to release mouse" +msgstr "按下 %s 或滑鼠中鍵釋放滑鼠" msgid "Bus" msgstr "匯流排" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index d79cc1b9e..1fb9b3fb5 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1295,7 +1295,7 @@ MainWindow::on_actionFullscreen_triggered() bool wasCaptured = mouse_capture == 1; char strFullscreen[100]; - sprintf(strFullscreen, qPrintable(tr("To return to windowed mode, press %s")), acc_keys[FindAccelerator("fullscreen")].seq); + sprintf(strFullscreen, qPrintable(tr("Press %s to return to windowed mode.")), 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"));