Implemented Alt+T and Alt+R hotkeys for Terminate and Restart.

This commit is contained in:
Ernie Pasveer
2026-01-25 09:50:21 -06:00
parent 58cbfa4585
commit de936868fa
5 changed files with 41 additions and 18 deletions
+1 -1
View File
@@ -1454,7 +1454,7 @@ void SeerGdbWidget::handleGdbTerminateExecutable (bool confirm) {
if (confirm) {
int result = QMessageBox::warning(this, "Seer",
QString("Terminate current session?"),
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel);
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Ok);
if (result == QMessageBox::Cancel) {
break;
+2 -1
View File
@@ -69,6 +69,8 @@ SeerKeySettings SeerKeySettings::populate () {
keySettings.add("Stepi", SeerKeySetting("Stepi", QKeySequence::fromString("Ctrl+F6"), "Execute the next instruction. Step into functions."));
keySettings.add("Finish", SeerKeySetting("Finish", QKeySequence::fromString("F7"), "Finish the current function."));
keySettings.add("Interrupt", SeerKeySetting("Interrupt", QKeySequence::fromString("Ctrl+I"), "Interrupt the executing program."));
keySettings.add("Terminate", SeerKeySetting("Terminate", QKeySequence::fromString("Alt+T"), "Terminate the debugging session."));
keySettings.add("Restart", SeerKeySetting("Restart", QKeySequence::fromString("Alt+R"), "Restart the debugging session."));
keySettings.add("Debug", SeerKeySetting("Debug", QKeySequence::fromString("Alt+D"), "Open the debug dialog."));
keySettings.add("Arguments", SeerKeySetting("Arguments", QKeySequence::fromString("Alt+A"), "Open the argument dialog."));
keySettings.add("Quit", SeerKeySetting("Quit", QKeySequence::fromString("Alt+Q"), "Quit Seer."));
@@ -78,7 +80,6 @@ SeerKeySettings SeerKeySettings::populate () {
keySettings.add("SearchLine", SeerKeySetting("SearchLine", QKeySequence::fromString("Ctrl+L"), "Seach for line number in the code editor."));
keySettings.add("AlternateDir", SeerKeySetting("AlternateDir", QKeySequence::fromString("Ctrl+O"), "Look for source file in an alternate directory."));
keySettings.add("ToggleBreakpoint", SeerKeySetting("ToggleBreakpoint", QKeySequence::fromString("Ctrl+B"), "Toggle the breakpoint status of current line."));
keySettings.add("ToggleRecordDirection", SeerKeySetting("ToggleRecordDirection", QKeySequence::fromString("Ctrl+D"), "Toggle the record playback direction."));
keySettings.add("ReverseContinue", SeerKeySetting("ReverseContinue", QKeySequence::fromString("Shift+F8"), "Continue execution of the program in reverse."));
keySettings.add("ReverseNext", SeerKeySetting("ReverseNext", QKeySequence::fromString("Shift+F5"), "Execute the previous line. Step over functions."));
+28 -10
View File
@@ -451,8 +451,8 @@ void SeerMainWindow::launchExecutable (const QString& launchMode, const QString&
actionGdbTerminate->setVisible(false);
actionGdbLaunch->setVisible(false);
actionControlRestart->setVisible(false);
actionControlTerminate->setVisible(false);
actionControlRestart->setVisible(true);
actionControlTerminate->setVisible(true);
actionControlInterrupt->setVisible(true);
if (launchMode == "run") {
@@ -860,6 +860,18 @@ void SeerMainWindow::handleTerminateExecutable () {
void SeerMainWindow::handleRestartExecutable () {
// Prompt if there's already a gdb running.
if (gdbWidget->isGdbRuning() == true) {
int result = QMessageBox::warning(this, "Seer",
QString("Restart current session?"),
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Ok);
if (result == QMessageBox::Cancel) {
return;
}
}
if (gdbWidget->isGdbRuning() == false && gdbWidget->hasBackupLaunchMode()) {
gdbWidget->restoreLaunchMode();
}
@@ -939,7 +951,8 @@ void SeerMainWindow::handleGdbStateChanged () {
// Launch and Restart. Applies to all.
actionGdbLaunch->setVisible(false);
actionGdbRestart->setVisible(false);
actionControlRestart->setVisible(false);
actionControlRestart->setVisible(true);
actionControlTerminate->setVisible(true);
// Run mode
if (gdbWidget->executableLaunchMode() == "run" || gdbWidget->executableLaunchMode() == "start" ||
@@ -948,7 +961,6 @@ void SeerMainWindow::handleGdbStateChanged () {
actionGdbTerminate->setVisible(true);
actionGdbTerminate->setText("Terminate");
actionGdbTerminate->setToolTip("Terminate the current debugging session.");
actionControlTerminate->setVisible(true);
actionControlTerminate->setText("Terminate");
actionControlTerminate->setToolTip("Terminate the current debugging session.");
@@ -958,7 +970,6 @@ void SeerMainWindow::handleGdbStateChanged () {
actionGdbTerminate->setVisible(true);
actionGdbTerminate->setText("Detach");
actionGdbTerminate->setToolTip("Detach from the current debugging session.");
actionControlTerminate->setVisible(true);
actionControlTerminate->setText("Detach");
actionControlTerminate->setToolTip("Detach from the current debugging session.");
@@ -968,7 +979,6 @@ void SeerMainWindow::handleGdbStateChanged () {
actionGdbTerminate->setVisible(true);
actionGdbTerminate->setText("Disconnect");
actionGdbTerminate->setToolTip("Disconnect from the current debugging session.");
actionControlTerminate->setVisible(true);
actionControlTerminate->setText("Disconnect");
actionControlTerminate->setToolTip("Disconnect from the current debugging session.");
@@ -993,7 +1003,8 @@ void SeerMainWindow::handleGdbStateChanged () {
// Hide terminate. Applies to all.
actionGdbTerminate->setVisible(false);
actionControlTerminate->setVisible(false);
actionControlRestart->setVisible(true);
actionControlTerminate->setVisible(true);
if (gdbWidget->backupLaunchMode() == "run" || gdbWidget->backupLaunchMode() == "start" ||
gdbWidget->backupLaunchMode() == "rr" || gdbWidget->backupLaunchMode() == "corefile") {
@@ -1001,7 +1012,6 @@ void SeerMainWindow::handleGdbStateChanged () {
actionGdbRestart->setVisible(true);
actionGdbRestart->setText("Restart");
actionGdbRestart->setToolTip("Restart the current debugging session.");
actionControlRestart->setVisible(true);
actionControlRestart->setText("Restart");
actionControlRestart->setToolTip("Restart the current debugging session.");
@@ -1009,7 +1019,6 @@ void SeerMainWindow::handleGdbStateChanged () {
actionGdbRestart->setVisible(true);
actionGdbRestart->setText("Reattach");
actionGdbRestart->setToolTip("Reattach the current debugging session.");
actionControlRestart->setVisible(true);
actionControlRestart->setText("Reattach");
actionControlRestart->setToolTip("Reattach the current debugging session.");
@@ -1017,7 +1026,6 @@ void SeerMainWindow::handleGdbStateChanged () {
actionGdbRestart->setVisible(true);
actionGdbRestart->setText("Reconnect");
actionGdbRestart->setToolTip("Reconnect the current debugging session.");
actionControlRestart->setVisible(true);
actionControlRestart->setText("Reconnect");
actionControlRestart->setToolTip("Reconnect the current debugging session.");
@@ -1778,6 +1786,7 @@ const SeerKeySettings SeerMainWindow::keySettings () const {
void SeerMainWindow::refreshShortCuts () {
// Dynamically change tool tip for 'Restart' depending on debug mode.
if (_keySettings.has("Restart")) {
SeerKeySetting setting = _keySettings.get("Restart");
@@ -1787,6 +1796,15 @@ void SeerMainWindow::refreshShortCuts () {
actionControlRestart->setShortcut(setting._sequence);
}
if (_keySettings.has("Terminate")) {
SeerKeySetting setting = _keySettings.get("Terminate");
actionGdbTerminate->setToolTip(setting._description);
actionGdbTerminate->setText(setting._action + " (" + setting._sequence.toString() + ")");
actionControlTerminate->setShortcut(setting._sequence);
}
if (_keySettings.has("Next")) {
SeerKeySetting setting = _keySettings.get("Next");
+8 -5
View File
@@ -336,10 +336,13 @@
<normaloff>:/seer/resources/RelaxLightIcons/view-refresh.svg</normaloff>:/seer/resources/RelaxLightIcons/view-refresh.svg</iconset>
</property>
<property name="text">
<string/>
<string>Restart</string>
</property>
<property name="toolTip">
<string>Restart the debugging session</string>
</property>
<property name="statusTip">
<string>Start the program in GDB. Honor breakpoints, if any.</string>
<string>Restart the debugging session. Honor breakpoints, if any.</string>
</property>
</action>
<action name="actionControlContinue">
@@ -716,13 +719,13 @@
<normaloff>:/seer/resources/RelaxLightIcons/system-shutdown.svg</normaloff>:/seer/resources/RelaxLightIcons/system-shutdown.svg</iconset>
</property>
<property name="text">
<string/>
<string>Terminate</string>
</property>
<property name="toolTip">
<string/>
<string>Terminate the debugging session</string>
</property>
<property name="statusTip">
<string/>
<string>Terminate the debugging session.</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
+2 -1
View File
@@ -110,4 +110,5 @@ int main() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
return 0;
}
}