Added pause shortcut.

This commit is contained in:
=
2025-04-20 14:31:46 -07:00
parent 9febdd1510
commit fd235bcf96
2 changed files with 14 additions and 6 deletions

View File

@@ -246,7 +246,10 @@ struct accelKey def_acc_keys[NUM_ACCELS] = {
.seq="Ctrl+Alt+F12" }, .seq="Ctrl+Alt+F12" },
{ .name="pause", .desc="Toggle pause", { .name="pause", .desc="Toggle pause",
.seq="Ctrl+Alt+F1" } .seq="Ctrl+Alt+F1" },
{ .name="mute", .desc="Toggle mute",
.seq="Ctrl+Alt+M" }
}; };

View File

@@ -836,6 +836,7 @@ void MainWindow::updateShortcuts()
ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence()); ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence());
ui->actionHard_Reset->setShortcut(QKeySequence()); ui->actionHard_Reset->setShortcut(QKeySequence());
ui->actionPause->setShortcut(QKeySequence()); ui->actionPause->setShortcut(QKeySequence());
ui->actionMute_Unmute->setShortcut(QKeySequence());
int accID; int accID;
QKeySequence seq; QKeySequence seq;
@@ -863,6 +864,10 @@ void MainWindow::updateShortcuts()
accID = FindAccelerator("pause"); accID = FindAccelerator("pause");
seq = QKeySequence::fromString(acc_keys[accID].seq); seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionPause->setShortcut(seq); ui->actionPause->setShortcut(seq);
accID = FindAccelerator("mute");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionMute_Unmute->setShortcut(seq);
} }
void void
@@ -1353,9 +1358,6 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
// Detect shortcuts when menubar is hidden // Detect shortcuts when menubar is hidden
// TODO: Could this be simplified by proxying the event and manually // TODO: Could this be simplified by proxying the event and manually
// shoving it into the menubar? // shoving it into the menubar?
// Note: This section should ONLY contain shortcuts that are valid
// when the emulator
if (event->type() == QEvent::KeyPress) if (event->type() == QEvent::KeyPress)
{ {
this->keyPressEvent((QKeyEvent *) event); this->keyPressEvent((QKeyEvent *) event);
@@ -1393,6 +1395,11 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
{ {
ui->actionPause->trigger(); ui->actionPause->trigger();
} }
if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("mute"))
{
ui->actionMute_Unmute->setShortcut(seq);
}
return true; return true;
} }
} }
@@ -1429,8 +1436,6 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
} }
} }
return QMainWindow::eventFilter(receiver, event); return QMainWindow::eventFilter(receiver, event);
} }