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); }