From a40cd098a606fe18b8c7a26941e3b19857819858 Mon Sep 17 00:00:00 2001 From: Hugo Teso Date: Wed, 5 Apr 2017 11:35:19 +0200 Subject: [PATCH] Closes #75 --- iaito_win32 | 2 +- src/mainwindow.cpp | 1 - src/mainwindow.h | 4 ++-- src/widgets/memwidget/memorywidget.cpp | 15 +++++++++++++++ src/widgets/memwidget/memorywidget.h | 1 + src/widgets/omnibar.cpp | 3 +++ 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/iaito_win32 b/iaito_win32 index e603905d..15d67a7a 160000 --- a/iaito_win32 +++ b/iaito_win32 @@ -1 +1 @@ -Subproject commit e603905db979bda6a95f4dd4b0b18ec2ab626f12 +Subproject commit 15d67a7acbbcef3e01acdb0a0986fe4d2468bb1f diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6201ee50..3dec950c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -824,7 +824,6 @@ void MainWindow::on_backButton_clicked() this->core->cmd("s-"); QString back_offset = this->core->cmd("s=").split(" > ").last().trimmed(); if (back_offset != "") { - this->add_debug_output(back_offset); this->seek(back_offset); } } diff --git a/src/mainwindow.h b/src/mainwindow.h index 19a3e560..b53bcea8 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -125,6 +125,8 @@ public slots: void toggleResponsive(bool maybe); + void on_backButton_clicked(); + private slots: void on_actionMem_triggered(); @@ -141,8 +143,6 @@ private slots: void on_actionRefresh_Panels_triggered(); - void on_backButton_clicked(); - void hideDummyColumns(); void on_actionCalculator_triggered(); diff --git a/src/widgets/memwidget/memorywidget.cpp b/src/widgets/memwidget/memorywidget.cpp index 8e497279..b87a0519 100644 --- a/src/widgets/memwidget/memorywidget.cpp +++ b/src/widgets/memwidget/memorywidget.cpp @@ -137,22 +137,32 @@ MemoryWidget::MemoryWidget(MainWindow *main, QWidget *parent) : // X to show hexdump QShortcut* hexdump_shortcut = new QShortcut(QKeySequence(Qt::Key_X), this->main); connect(hexdump_shortcut, SIGNAL(activated()), this, SLOT(showHexdump())); + //hexdump_shortcut->setContext(Qt::WidgetShortcut); // Space to switch between disassembly and graph QShortcut* graph_shortcut = new QShortcut(QKeySequence(Qt::Key_Space), this->main); connect(graph_shortcut, SIGNAL(activated()), this, SLOT(cycleViews())); + //graph_shortcut->setContext(Qt::WidgetShortcut); // Semicolon to add comment QShortcut* comment_shortcut = new QShortcut(QKeySequence(Qt::Key_Semicolon), ui->disasTextEdit_2); connect(comment_shortcut, SIGNAL(activated()), this, SLOT(on_actionDisasAdd_comment_triggered())); + comment_shortcut->setContext(Qt::WidgetShortcut); // N to rename function QShortcut* rename_shortcut = new QShortcut(QKeySequence(Qt::Key_N), ui->disasTextEdit_2); connect(rename_shortcut, SIGNAL(activated()), this, SLOT(on_actionFunctionsRename_triggered())); + rename_shortcut->setContext(Qt::WidgetShortcut); // R to show XRefs QShortcut* xrefs_shortcut = new QShortcut(QKeySequence(Qt::Key_R), ui->disasTextEdit_2); connect(xrefs_shortcut, SIGNAL(activated()), this, SLOT(on_actionXRefs_triggered())); + xrefs_shortcut->setContext(Qt::WidgetShortcut); + + // Esc to seek back + QShortcut* back_shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), ui->disasTextEdit_2); + connect(back_shortcut, SIGNAL(activated()), this, SLOT(seek_back())); + back_shortcut->setContext(Qt::WidgetShortcut); // Control Disasm and Hex scroll to add more contents connect(this->disasTextEdit->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(disasmScrolled())); @@ -1705,3 +1715,8 @@ void MemoryWidget::selectHexPreview() { ui->hexBitsComboBox_2->setCurrentIndex(ui->hexBitsComboBox_2->findText(bits)); } } + +void MemoryWidget::seek_back() { + //this->main->add_debug_output("Back!"); + this->main->on_backButton_clicked(); +} diff --git a/src/widgets/memwidget/memorywidget.h b/src/widgets/memwidget/memorywidget.h index c95d889e..6684228a 100644 --- a/src/widgets/memwidget/memorywidget.h +++ b/src/widgets/memwidget/memorywidget.h @@ -164,6 +164,7 @@ private slots: void on_simpleGrapgToolButton_clicked(); QString normalizeAddr(QString addr); void on_opcodeDescButton_clicked(); + void seek_back(); }; #endif // MEMORYWIDGET_H diff --git a/src/widgets/omnibar.cpp b/src/widgets/omnibar.cpp index a616be66..552ed13d 100644 --- a/src/widgets/omnibar.cpp +++ b/src/widgets/omnibar.cpp @@ -41,6 +41,7 @@ Omnibar::Omnibar(MainWindow *main, QWidget *parent) : // Esc clears omnibar QShortcut* clear_shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this); connect(clear_shortcut, SIGNAL(activated()), this, SLOT(clearContents())); + clear_shortcut->setContext(Qt::WidgetShortcut); } void Omnibar::setupCompleter() { @@ -83,7 +84,9 @@ void Omnibar::showCommands() { void Omnibar::clearContents() { this->setText(""); + // Necessary hack to make it work properly this->clearFocus(); + this->setFocus(); } void Omnibar::on_gotoEntry_returnPressed()