1
0
Fork 0

GUI: moved all QAction->setShortcut into separate functions + fixed a bug with shortcuts in the register view + fixed a bug with copying in the register view

This commit is contained in:
Mr. eXoDia 2014-07-30 02:13:29 +02:00
parent 1ed721fbef
commit b8a6f2da3d
18 changed files with 145 additions and 115 deletions

View File

@ -1,4 +1,5 @@
#include "ReferenceView.h"
#include "Configuration.h"
ReferenceView::ReferenceView()
{
@ -39,7 +40,6 @@ void ReferenceView::setupContextMenu()
mToggleBreakpoint = new QAction("Toggle Breakpoint", this);
mToggleBreakpoint->setShortcutContext(Qt::WidgetShortcut);
mToggleBreakpoint->setShortcut(QKeySequence("F2"));
this->addAction(mToggleBreakpoint);
mList->addAction(mToggleBreakpoint);
mSearchList->addAction(mToggleBreakpoint);
@ -47,11 +47,19 @@ void ReferenceView::setupContextMenu()
mToggleBookmark = new QAction("Toggle Bookmark", this);
mToggleBookmark->setShortcutContext(Qt::WidgetShortcut);
mToggleBookmark->setShortcut(QKeySequence("ctrl+d"));
this->addAction(mToggleBookmark);
mList->addAction(mToggleBookmark);
mSearchList->addAction(mToggleBookmark);
connect(mToggleBookmark, SIGNAL(triggered()), this, SLOT(toggleBookmark()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void ReferenceView::refreshShortcutsSlot()
{
mToggleBreakpoint->setShortcut(QKeySequence("F2"));
mToggleBookmark->setShortcut(QKeySequence("ctrl+d"));
}
void ReferenceView::addColumnAt(int width, QString title)

View File

@ -29,6 +29,7 @@ private slots:
void followGenericAddress();
void toggleBreakpoint();
void toggleBookmark();
void refreshShortcutsSlot();
signals:
void showCpu();

View File

@ -1,4 +1,5 @@
#include "BreakpointsView.h"
#include "Configuration.h"
BreakpointsView::BreakpointsView(QWidget *parent) : QWidget(parent)
{
@ -49,6 +50,9 @@ BreakpointsView::BreakpointsView(QWidget *parent) : QWidget(parent)
setupSoftBPRightClickContextMenu();
setupMemBPRightClickContextMenu();
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
// Signals/Slots
connect(Bridge::getBridge(), SIGNAL(updateBreakpoints()), this, SLOT(reloadData()));
connect(mHardBPTable, SIGNAL(contextMenuSignal(const QPoint &)), this, SLOT(hardwareBPContextMenuSlot(const QPoint &)));
@ -171,7 +175,6 @@ void BreakpointsView::setupHardBPRightClickContextMenu()
// Remove
mHardBPRemoveAction = new QAction("Remove", this);
mHardBPRemoveAction->setShortcutContext(Qt::WidgetShortcut);
mHardBPRemoveAction->setShortcut(QKeySequence(Qt::Key_Delete));
mHardBPTable->addAction(mHardBPRemoveAction);
connect(mHardBPRemoveAction, SIGNAL(triggered()), this, SLOT(removeHardBPActionSlot()));
@ -182,11 +185,22 @@ void BreakpointsView::setupHardBPRightClickContextMenu()
// Enable/Disable
mHardBPEnableDisableAction = new QAction("Enable", this);
mHardBPEnableDisableAction->setShortcutContext(Qt::WidgetShortcut);
mHardBPEnableDisableAction->setShortcut(QKeySequence(Qt::Key_Space));
mHardBPTable->addAction(mHardBPEnableDisableAction);
connect(mHardBPEnableDisableAction, SIGNAL(triggered()), this, SLOT(enableDisableHardBPActionSlot()));
}
void BreakpointsView::refreshShortcutsSlot()
{
mHardBPRemoveAction->setShortcut(QKeySequence(Qt::Key_Delete));
mHardBPEnableDisableAction->setShortcut(QKeySequence(Qt::Key_Space));
mSoftBPRemoveAction->setShortcut(QKeySequence(Qt::Key_Delete));
mSoftBPEnableDisableAction->setShortcut(QKeySequence(Qt::Key_Space));
mMemBPRemoveAction->setShortcut(QKeySequence(Qt::Key_Delete));
mMemBPEnableDisableAction->setShortcut(QKeySequence(Qt::Key_Space));
}
void BreakpointsView::hardwareBPContextMenuSlot(const QPoint & pos)
{
if(mHardBPTable->getRowCount() != 0)
@ -277,7 +291,6 @@ void BreakpointsView::setupSoftBPRightClickContextMenu()
// Remove
mSoftBPRemoveAction = new QAction("Remove", this);
mSoftBPRemoveAction->setShortcutContext(Qt::WidgetShortcut);
mSoftBPRemoveAction->setShortcut(QKeySequence(Qt::Key_Delete));
mSoftBPTable->addAction(mSoftBPRemoveAction);
connect(mSoftBPRemoveAction, SIGNAL(triggered()), this, SLOT(removeSoftBPActionSlot()));
@ -288,7 +301,6 @@ void BreakpointsView::setupSoftBPRightClickContextMenu()
// Enable/Disable
mSoftBPEnableDisableAction = new QAction("Enable", this);
mSoftBPEnableDisableAction->setShortcutContext(Qt::WidgetShortcut);
mSoftBPEnableDisableAction->setShortcut(QKeySequence(Qt::Key_Space));
mSoftBPTable->addAction(mSoftBPEnableDisableAction);
connect(mSoftBPEnableDisableAction, SIGNAL(triggered()), this, SLOT(enableDisableSoftBPActionSlot()));
}
@ -382,7 +394,6 @@ void BreakpointsView::setupMemBPRightClickContextMenu()
// Remove
mMemBPRemoveAction = new QAction("Remove", this);
mMemBPRemoveAction->setShortcutContext(Qt::WidgetShortcut);
mMemBPRemoveAction->setShortcut(QKeySequence(Qt::Key_Delete));
mMemBPTable->addAction(mMemBPRemoveAction);
connect(mMemBPRemoveAction, SIGNAL(triggered()), this, SLOT(removeMemBPActionSlot()));
@ -393,7 +404,6 @@ void BreakpointsView::setupMemBPRightClickContextMenu()
// Enable/Disable
mMemBPEnableDisableAction = new QAction("Enable", this);
mMemBPEnableDisableAction->setShortcutContext(Qt::WidgetShortcut);
mMemBPEnableDisableAction->setShortcut(QKeySequence(Qt::Key_Space));
mMemBPTable->addAction(mMemBPEnableDisableAction);
connect(mMemBPEnableDisableAction, SIGNAL(triggered()), this, SLOT(enableDisableMemBPActionSlot()));
}

View File

@ -23,6 +23,7 @@ signals:
void showCpu();
public slots:
void refreshShortcutsSlot();
void reloadData();
// Hardware

View File

@ -237,7 +237,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//Binary->Edit
mBinaryEditAction = new QAction("&Edit", this);
mBinaryEditAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryEditAction->setShortcut(QKeySequence("ctrl+e"));
this->addAction(mBinaryEditAction);
mBinaryMenu->addAction(mBinaryEditAction);
connect(mBinaryEditAction, SIGNAL(triggered()), this, SLOT(binaryEditSlot()));
@ -245,7 +244,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//Binary->Fill
mBinaryFillAction = new QAction("&Fill...", this);
mBinaryFillAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryFillAction->setShortcut(QKeySequence("f"));
this->addAction(mBinaryFillAction);
connect(mBinaryFillAction, SIGNAL(triggered()), this, SLOT(binaryFillSlot()));
mBinaryMenu->addAction(mBinaryFillAction);
@ -253,7 +251,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//Binary->Fill with NOPs
mBinaryFillNopsAction = new QAction("Fill with &NOPs", this);
mBinaryFillNopsAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryFillNopsAction->setShortcut(QKeySequence("ctrl+9"));
this->addAction(mBinaryFillNopsAction);
connect(mBinaryFillNopsAction, SIGNAL(triggered()), this, SLOT(binaryFillNopsSlot()));
mBinaryMenu->addAction(mBinaryFillNopsAction);
@ -264,7 +261,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//Binary->Copy
mBinaryCopyAction = new QAction("&Copy", this);
mBinaryCopyAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryCopyAction->setShortcut(QKeySequence("shift+c"));
this->addAction(mBinaryCopyAction);
connect(mBinaryCopyAction, SIGNAL(triggered()), this, SLOT(binaryCopySlot()));
mBinaryMenu->addAction(mBinaryCopyAction);
@ -272,7 +268,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//Binary->Paste
mBinaryPasteAction = new QAction("&Paste", this);
mBinaryPasteAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryPasteAction->setShortcut(QKeySequence("shift+v"));
this->addAction(mBinaryPasteAction);
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
@ -280,7 +275,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
mBinaryPasteIgnoreSizeAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryPasteIgnoreSizeAction->setShortcut(QKeySequence("ctrl+shift+v"));
this->addAction(mBinaryPasteIgnoreSizeAction);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
@ -288,42 +282,36 @@ void CPUDisassembly::setupRightClickContextMenu()
// Restore Selection
mUndoSelection = new QAction("&Restore selection", this);
mUndoSelection->setShortcutContext(Qt::WidgetShortcut);
mUndoSelection->setShortcut(QKeySequence("ctrl+backspace"));
this->addAction(mUndoSelection);
connect(mUndoSelection, SIGNAL(triggered()), this, SLOT(undoSelectionSlot()));
// Labels
mSetLabel = new QAction("Label", this);
mSetLabel->setShortcutContext(Qt::WidgetShortcut);
mSetLabel->setShortcut(QKeySequence(":"));
this->addAction(mSetLabel);
connect(mSetLabel, SIGNAL(triggered()), this, SLOT(setLabel()));
// Comments
mSetComment = new QAction("Comment", this);
mSetComment->setShortcutContext(Qt::WidgetShortcut);
mSetComment->setShortcut(QKeySequence(";"));
this->addAction(mSetComment);
connect(mSetComment, SIGNAL(triggered()), this, SLOT(setComment()));
// Bookmarks
mSetBookmark = new QAction("Bookmark", this);
mSetBookmark->setShortcutContext(Qt::WidgetShortcut);
mSetBookmark->setShortcut(QKeySequence("ctrl+d"));
this->addAction(mSetBookmark);
connect(mSetBookmark, SIGNAL(triggered()), this, SLOT(setBookmark()));
// Functions
mToggleFunction = new QAction("Function", this);
mToggleFunction->setShortcutContext(Qt::WidgetShortcut);
mToggleFunction->setShortcut(QKeySequence("shift+f"));
this->addAction(mToggleFunction);
connect(mToggleFunction, SIGNAL(triggered()), this, SLOT(toggleFunction()));
// Assemble
mAssemble = new QAction("Assemble", this);
mAssemble->setShortcutContext(Qt::WidgetShortcut);
mAssemble->setShortcut(QKeySequence("space"));
this->addAction(mAssemble);
connect(mAssemble, SIGNAL(triggered()), this, SLOT(assembleAt()));
@ -334,7 +322,6 @@ void CPUDisassembly::setupRightClickContextMenu()
// Standard breakpoint (option set using SetBPXOption)
mToggleInt3BpAction = new QAction("Toggle", this);
mToggleInt3BpAction->setShortcutContext(Qt::WidgetShortcut);
mToggleInt3BpAction->setShortcut(QKeySequence(Qt::Key_F2));
this->addAction(mToggleInt3BpAction);
connect(mToggleInt3BpAction, SIGNAL(triggered()), this, SLOT(toggleInt3BPAction()));
@ -361,7 +348,6 @@ void CPUDisassembly::setupRightClickContextMenu()
mPatchesAction = new QAction(QIcon(":/icons/images/patch.png"), "Patches", this);
mPatchesAction->setShortcutContext(Qt::WidgetShortcut);
mPatchesAction->setShortcut(QKeySequence("ctrl+p"));
connect(mPatchesAction, SIGNAL(triggered()), this, SLOT(showPatchesSlot()));
//--------------------------------------------------------------------
@ -369,7 +355,6 @@ void CPUDisassembly::setupRightClickContextMenu()
//---------------------- New origin here -----------------------------
mSetNewOriginHere = new QAction("Set New Origin Here", this);
mSetNewOriginHere->setShortcutContext(Qt::WidgetShortcut);
mSetNewOriginHere->setShortcut(QKeySequence("ctrl+*"));
this->addAction(mSetNewOriginHere);
connect(mSetNewOriginHere, SIGNAL(triggered()), this, SLOT(setNewOriginHereActionSlot()));
@ -381,28 +366,24 @@ void CPUDisassembly::setupRightClickContextMenu()
// Origin action
mGotoOrigin = new QAction("Origin", this);
mGotoOrigin->setShortcutContext(Qt::WidgetShortcut);
mGotoOrigin->setShortcut(QKeySequence("*"));
this->addAction(mGotoOrigin);
connect(mGotoOrigin, SIGNAL(triggered()), this, SLOT(gotoOrigin()));
// Previous action
mGotoPrevious = new QAction("Previous", this);
mGotoPrevious->setShortcutContext(Qt::WidgetShortcut);
mGotoPrevious->setShortcut(QKeySequence("-"));
this->addAction(mGotoPrevious);
connect(mGotoPrevious, SIGNAL(triggered()), this, SLOT(gotoPrevious()));
// Next action
mGotoNext = new QAction("Next", this);
mGotoNext->setShortcutContext(Qt::WidgetShortcut);
mGotoNext->setShortcut(QKeySequence("+"));
this->addAction(mGotoNext);
connect(mGotoNext, SIGNAL(triggered()), this, SLOT(gotoNext()));
// Address action
mGotoExpression = new QAction("Expression", this);
mGotoExpression->setShortcutContext(Qt::WidgetShortcut);
mGotoExpression->setShortcut(QKeySequence("ctrl+g"));
this->addAction(mGotoExpression);
connect(mGotoExpression, SIGNAL(triggered()), this, SLOT(gotoExpression()));
@ -417,7 +398,6 @@ void CPUDisassembly::setupRightClickContextMenu()
// Selected address
mReferenceSelectedAddress = new QAction("&Selected address", this);
mReferenceSelectedAddress->setShortcutContext(Qt::WidgetShortcut);
mReferenceSelectedAddress->setShortcut(QKeySequence("ctrl+r"));
this->addAction(mReferenceSelectedAddress);
connect(mReferenceSelectedAddress, SIGNAL(triggered()), this, SLOT(findReferences()));
@ -443,7 +423,6 @@ void CPUDisassembly::setupRightClickContextMenu()
// Pattern
mSearchPattern = new QAction("&Pattern", this);
mSearchPattern->setShortcutContext(Qt::WidgetShortcut);
mSearchPattern->setShortcut(QKeySequence("ctrl+b"));
this->addAction(mSearchPattern);
connect(mSearchPattern, SIGNAL(triggered()), this, SLOT(findPattern()));
mSearchMenu->addAction(mSearchPattern);
@ -451,9 +430,37 @@ void CPUDisassembly::setupRightClickContextMenu()
// Highlighting mode
mEnableHighlightingMode = new QAction("&Highlighting mode", this);
mEnableHighlightingMode->setShortcutContext(Qt::WidgetShortcut);
mEnableHighlightingMode->setShortcut(QKeySequence("ctrl+h"));
this->addAction(mEnableHighlightingMode);
connect(mEnableHighlightingMode, SIGNAL(triggered()), this, SLOT(enableHighlightingMode()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void CPUDisassembly::refreshShortcutsSlot()
{
mBinaryEditAction->setShortcut(QKeySequence("ctrl+e"));
mBinaryFillAction->setShortcut(QKeySequence("f"));
mBinaryFillNopsAction->setShortcut(QKeySequence("ctrl+9"));
mBinaryCopyAction->setShortcut(QKeySequence("shift+c"));
mBinaryPasteAction->setShortcut(QKeySequence("shift+v"));
mBinaryPasteIgnoreSizeAction->setShortcut(QKeySequence("ctrl+shift+v"));
mUndoSelection->setShortcut(QKeySequence("ctrl+backspace"));
mSetLabel->setShortcut(QKeySequence(":"));
mSetComment->setShortcut(QKeySequence(";"));
mSetBookmark->setShortcut(QKeySequence("ctrl+d"));
mToggleFunction->setShortcut(QKeySequence("shift+f"));
mAssemble->setShortcut(QKeySequence("space"));
mToggleInt3BpAction->setShortcut(QKeySequence(Qt::Key_F2));
mPatchesAction->setShortcut(QKeySequence("ctrl+p"));
mSetNewOriginHere->setShortcut(QKeySequence("ctrl+*"));
mGotoOrigin->setShortcut(QKeySequence("*"));
mGotoPrevious->setShortcut(QKeySequence("-"));
mGotoNext->setShortcut(QKeySequence("+"));
mGotoExpression->setShortcut(QKeySequence("ctrl+g"));
mReferenceSelectedAddress->setShortcut(QKeySequence("ctrl+r"));
mSearchPattern->setShortcut(QKeySequence("ctrl+b"));
mEnableHighlightingMode->setShortcut(QKeySequence("ctrl+h"));
}
void CPUDisassembly::gotoOrigin()

View File

@ -35,6 +35,7 @@ signals:
void showPatches();
public slots:
void refreshShortcutsSlot();
void toggleInt3BPAction();
void toggleHwBpActionSlot();
void setHwBpOnSlot0ActionSlot();

View File

@ -85,7 +85,6 @@ void CPUDump::setupContextMenu()
//Binary->Edit
mBinaryEditAction = new QAction("&Edit", this);
mBinaryEditAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryEditAction->setShortcut(QKeySequence("ctrl+e"));
this->addAction(mBinaryEditAction);
connect(mBinaryEditAction, SIGNAL(triggered()), this, SLOT(binaryEditSlot()));
mBinaryMenu->addAction(mBinaryEditAction);
@ -93,7 +92,6 @@ void CPUDump::setupContextMenu()
//Binary->Fill
mBinaryFillAction = new QAction("&Fill...", this);
mBinaryFillAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryFillAction->setShortcut(QKeySequence("f"));
this->addAction(mBinaryFillAction);
connect(mBinaryFillAction, SIGNAL(triggered()), this, SLOT(binaryFillSlot()));
mBinaryMenu->addAction(mBinaryFillAction);
@ -104,7 +102,6 @@ void CPUDump::setupContextMenu()
//Binary->Copy
mBinaryCopyAction = new QAction("&Copy", this);
mBinaryCopyAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryCopyAction->setShortcut(QKeySequence("shift+c"));
this->addAction(mBinaryCopyAction);
connect(mBinaryCopyAction, SIGNAL(triggered()), this, SLOT(binaryCopySlot()));
mBinaryMenu->addAction(mBinaryCopyAction);
@ -112,7 +109,6 @@ void CPUDump::setupContextMenu()
//Binary->Paste
mBinaryPasteAction = new QAction("&Paste", this);
mBinaryPasteAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryPasteAction->setShortcut(QKeySequence("shift+v"));
this->addAction(mBinaryPasteAction);
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
@ -120,7 +116,6 @@ void CPUDump::setupContextMenu()
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
mBinaryPasteIgnoreSizeAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryPasteIgnoreSizeAction->setShortcut(QKeySequence("ctrl+shift+v"));
this->addAction(mBinaryPasteIgnoreSizeAction);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
@ -128,14 +123,12 @@ void CPUDump::setupContextMenu()
// Restore Selection
mUndoSelection = new QAction("&Restore selection", this);
mUndoSelection->setShortcutContext(Qt::WidgetShortcut);
mUndoSelection->setShortcut(QKeySequence("ctrl+backspace"));
this->addAction(mUndoSelection);
connect(mUndoSelection, SIGNAL(triggered()), this, SLOT(undoSelectionSlot()));
//Label
mSetLabelAction = new QAction("Set Label", this);
mSetLabelAction->setShortcutContext(Qt::WidgetShortcut);
mSetLabelAction->setShortcut(QKeySequence(":"));
this->addAction(mSetLabelAction);
connect(mSetLabelAction, SIGNAL(triggered()), this, SLOT(setLabelSlot()));
@ -227,7 +220,6 @@ void CPUDump::setupContextMenu()
//Find Pattern
mFindPatternAction = new QAction("&Find Pattern...", this);
mFindPatternAction->setShortcutContext(Qt::WidgetShortcut);
mFindPatternAction->setShortcut(QKeySequence("ctrl+b"));
this->addAction(mFindPatternAction);
connect(mFindPatternAction, SIGNAL(triggered()), this, SLOT(findPattern()));
@ -236,7 +228,6 @@ void CPUDump::setupContextMenu()
//Goto->Expression
mGotoExpression = new QAction("&Expression", this);
mGotoExpression->setShortcutContext(Qt::WidgetShortcut);
mGotoExpression->setShortcut(QKeySequence("ctrl+g"));
this->addAction(mGotoExpression);
connect(mGotoExpression, SIGNAL(triggered()), this, SLOT(gotoExpressionSlot()));
mGotoMenu->addAction(mGotoExpression);
@ -330,6 +321,22 @@ void CPUDump::setupContextMenu()
//Disassembly
mDisassemblyAction = new QAction("&Disassembly", this);
connect(mDisassemblyAction, SIGNAL(triggered()), this, SLOT(disassemblySlot()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void CPUDump::refreshShortcutsSlot()
{
mBinaryEditAction->setShortcut(QKeySequence("ctrl+e"));
mBinaryFillAction->setShortcut(QKeySequence("f"));
mBinaryCopyAction->setShortcut(QKeySequence("shift+c"));
mBinaryPasteAction->setShortcut(QKeySequence("shift+v"));
mBinaryPasteIgnoreSizeAction->setShortcut(QKeySequence("ctrl+shift+v"));
mUndoSelection->setShortcut(QKeySequence("ctrl+backspace"));
mSetLabelAction->setShortcut(QKeySequence(":"));
mFindPatternAction->setShortcut(QKeySequence("ctrl+b"));
mGotoExpression->setShortcut(QKeySequence("ctrl+g"));
}
QString CPUDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)

View File

@ -25,6 +25,7 @@ signals:
void displayReferencesWidget();
public slots:
void refreshShortcutsSlot();
void memoryAccessSingleshootSlot();
void memoryAccessRestoreSlot();
void memoryWriteSingleshootSlot();

View File

@ -63,7 +63,6 @@ void CPUStack::setupContextMenu()
//Binary->Edit
mBinaryEditAction = new QAction("&Edit", this);
mBinaryEditAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryEditAction->setShortcut(QKeySequence("ctrl+e"));
this->addAction(mBinaryEditAction);
connect(mBinaryEditAction, SIGNAL(triggered()), this, SLOT(binaryEditSlot()));
mBinaryMenu->addAction(mBinaryEditAction);
@ -71,7 +70,6 @@ void CPUStack::setupContextMenu()
//Binary->Fill
mBinaryFillAction = new QAction("&Fill...", this);
mBinaryFillAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryFillAction->setShortcut(QKeySequence("f"));
this->addAction(mBinaryFillAction);
connect(mBinaryFillAction, SIGNAL(triggered()), this, SLOT(binaryFillSlot()));
mBinaryMenu->addAction(mBinaryFillAction);
@ -82,7 +80,6 @@ void CPUStack::setupContextMenu()
//Binary->Copy
mBinaryCopyAction = new QAction("&Copy", this);
mBinaryCopyAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryCopyAction->setShortcut(QKeySequence("shift+c"));
this->addAction(mBinaryCopyAction);
connect(mBinaryCopyAction, SIGNAL(triggered()), this, SLOT(binaryCopySlot()));
mBinaryMenu->addAction(mBinaryCopyAction);
@ -90,7 +87,6 @@ void CPUStack::setupContextMenu()
//Binary->Paste
mBinaryPasteAction = new QAction("&Paste", this);
mBinaryPasteAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryPasteAction->setShortcut(QKeySequence("shift+v"));
this->addAction(mBinaryPasteAction);
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
@ -98,7 +94,6 @@ void CPUStack::setupContextMenu()
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
mBinaryPasteIgnoreSizeAction->setShortcutContext(Qt::WidgetShortcut);
mBinaryPasteIgnoreSizeAction->setShortcut(QKeySequence("ctrl+shift+v"));
this->addAction(mBinaryPasteIgnoreSizeAction);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
@ -106,7 +101,6 @@ void CPUStack::setupContextMenu()
// Restore Selection
mUndoSelection = new QAction("&Restore selection", this);
mUndoSelection->setShortcutContext(Qt::WidgetShortcut);
mUndoSelection->setShortcut(QKeySequence("ctrl+backspace"));
this->addAction(mUndoSelection);
connect(mUndoSelection, SIGNAL(triggered()), this, SLOT(undoSelectionSlot()));
@ -122,7 +116,6 @@ void CPUStack::setupContextMenu()
mGotoBp = new QAction("Follow E&BP", this);
#endif //_WIN64
mGotoSp->setShortcutContext(Qt::WidgetShortcut);
mGotoSp->setShortcut(QKeySequence("*"));
this->addAction(mGotoSp);
connect(mGotoSp, SIGNAL(triggered()), this, SLOT(gotoSpSlot()));
connect(mGotoBp, SIGNAL(triggered()), this, SLOT(gotoBpSlot()));
@ -130,13 +123,11 @@ void CPUStack::setupContextMenu()
//Find Pattern
mFindPatternAction = new QAction("&Find Pattern...", this);
mFindPatternAction->setShortcutContext(Qt::WidgetShortcut);
mFindPatternAction->setShortcut(QKeySequence("ctrl+b"));
this->addAction(mFindPatternAction);
connect(mFindPatternAction, SIGNAL(triggered()), this, SLOT(findPattern()));
mGotoExpression = new QAction("&Expression", this);
mGotoExpression->setShortcutContext(Qt::WidgetShortcut);
mGotoExpression->setShortcut(QKeySequence("ctrl+g"));
this->addAction(mGotoExpression);
connect(mGotoExpression, SIGNAL(triggered()), this, SLOT(gotoExpressionSlot()));
@ -145,12 +136,29 @@ void CPUStack::setupContextMenu()
mFollowDisasm->setShortcut(QKeySequence("enter"));
this->addAction(mFollowDisasm);
connect(mFollowDisasm, SIGNAL(triggered()), this, SLOT(followDisasmSlot()));
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followDisasmSlot()));
mFollowDump = new QAction("Follow in &Dump", this);
connect(mFollowDump, SIGNAL(triggered()), this, SLOT(followDumpSlot()));
mFollowStack = new QAction("Follow in &Stack", this);
connect(mFollowStack, SIGNAL(triggered()), this, SLOT(followStackSlot()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void CPUStack::refreshShortcutsSlot()
{
mBinaryEditAction->setShortcut(QKeySequence("ctrl+e"));
mBinaryFillAction->setShortcut(QKeySequence("f"));
mBinaryCopyAction->setShortcut(QKeySequence("shift+c"));
mBinaryPasteAction->setShortcut(QKeySequence("shift+v"));
mBinaryPasteIgnoreSizeAction->setShortcut(QKeySequence("ctrl+shift+v"));
mUndoSelection->setShortcut(QKeySequence("ctrl+backspace"));
mGotoSp->setShortcut(QKeySequence("*"));
mFindPatternAction->setShortcut(QKeySequence("ctrl+b"));
mGotoExpression->setShortcut(QKeySequence("ctrl+g"));
}
QString CPUStack::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)

View File

@ -26,6 +26,7 @@ signals:
void displayReferencesWidget();
public slots:
void refreshShortcutsSlot();
void stackDumpAt(uint_t addr, uint_t csp);
void gotoSpSlot();
void gotoBpSlot();

View File

@ -25,19 +25,11 @@ void CallStackView::setupContextMenu()
mFollowTo->setShortcutContext(Qt::WidgetShortcut);
mFollowTo->setShortcut(QKeySequence("enter"));
connect(mFollowTo, SIGNAL(triggered()), this, SLOT(followTo()));
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followTo()));
mFollowFrom = new QAction("Follow &From", this);
connect(mFollowFrom, SIGNAL(triggered()), this, SLOT(followFrom()));
}
void CallStackView::keyPressEvent(QKeyEvent* event)
{
int key = event->key();
if(key == Qt::Key_Enter || key == Qt::Key_Return)
followTo();
else
StdTable::keyPressEvent(event);
}
void CallStackView::updateCallStack()
{
DBGCALLSTACK callstack;

View File

@ -9,7 +9,6 @@ class CallStackView : public StdTable
public:
explicit CallStackView(StdTable* parent = 0);
void setupContextMenu();
void keyPressEvent(QKeyEvent* event);
signals:
void showCpu();

View File

@ -21,15 +21,6 @@ MemoryMapView::MemoryMapView(StdTable *parent) : StdTable(parent)
setupContextMenu();
}
void MemoryMapView::keyPressEvent(QKeyEvent* event)
{
int key = event->key();
if(key == Qt::Key_Enter || key == Qt::Key_Return)
followDisassemblerSlot();
else
StdTable::keyPressEvent(event);
}
void MemoryMapView::setupContextMenu()
{
//Follow in Dump
@ -41,6 +32,7 @@ void MemoryMapView::setupContextMenu()
mFollowDisassembly->setShortcutContext(Qt::WidgetShortcut);
mFollowDisassembly->setShortcut(QKeySequence("enter"));
connect(mFollowDisassembly, SIGNAL(triggered()), this, SLOT(followDisassemblerSlot()));
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followDisassemblerSlot()));
//Breakpoint menu
mBreakpointMenu = new QMenu("Memory &Breakpoint", this);
@ -69,7 +61,6 @@ void MemoryMapView::setupContextMenu()
mMemoryExecuteMenu = new QMenu("Execute", this);
mMemoryExecuteSingleshoot = new QAction("&Singleshoot", this);
mMemoryExecuteSingleshoot->setShortcutContext(Qt::WidgetShortcut);
mMemoryExecuteSingleshoot->setShortcut(QKeySequence("f2"));
connect(mMemoryExecuteSingleshoot, SIGNAL(triggered()), this, SLOT(memoryExecuteSingleshootSlot()));
mMemoryExecuteMenu->addAction(mMemoryExecuteSingleshoot);
mMemoryExecuteRestore = new QAction("&Restore", this);
@ -80,16 +71,24 @@ void MemoryMapView::setupContextMenu()
//Breakpoint->Remove
mMemoryRemove = new QAction("&Remove", this);
mMemoryRemove->setShortcutContext(Qt::WidgetShortcut);
mMemoryRemove->setShortcut(QKeySequence("f2"));
connect(mMemoryRemove, SIGNAL(triggered()), this, SLOT(memoryRemoveSlot()));
mBreakpointMenu->addAction(mMemoryRemove);
//Action shortcut action that does something
mMemoryExecuteSingleshootToggle = new QAction(this);
mMemoryExecuteSingleshootToggle->setShortcutContext(Qt::WidgetShortcut);
mMemoryExecuteSingleshootToggle->setShortcut(QKeySequence("f2"));
this->addAction(mMemoryExecuteSingleshootToggle);
connect(mMemoryExecuteSingleshootToggle, SIGNAL(triggered()), this, SLOT(memoryExecuteSingleshootToggleSlot()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void MemoryMapView::refreshShortcutsSlot()
{
mMemoryExecuteSingleshoot->setShortcut(QKeySequence("f2"));
mMemoryRemove->setShortcut(QKeySequence("f2"));
mMemoryExecuteSingleshootToggle->setShortcut(QKeySequence("f2"));
}
void MemoryMapView::contextMenuSlot(const QPoint &pos)

View File

@ -11,13 +11,13 @@ class MemoryMapView : public StdTable
public:
explicit MemoryMapView(StdTable *parent = 0);
QString paintContent(QPainter *painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
void keyPressEvent(QKeyEvent* event);
void setupContextMenu();
signals:
void showCpu();
public slots:
void refreshShortcutsSlot();
void stateChangedSlot(DBGSTATE state);
void followDumpSlot();
void followDisassemblerSlot();

View File

@ -5,19 +5,19 @@ RegistersView::RegistersView(QWidget * parent) : QAbstractScrollArea(parent), mV
{
// precreate ContextMenu Actions
wCM_Increment = new QAction(tr("Increment"),this);
wCM_Increment->setShortcut(Qt::Key_Plus);
this->addAction(wCM_Increment);
wCM_Decrement = new QAction(tr("Decrement"),this);
wCM_Decrement->setShortcut(Qt::Key_Minus);
this->addAction(wCM_Decrement);
wCM_Zero = new QAction(tr("Zero"),this);
wCM_Zero->setShortcut(Qt::Key_0);
this->addAction(wCM_Zero);
wCM_SetToOne = new QAction(tr("Set to 1"),this);
wCM_SetToOne->setShortcut(Qt::Key_1);
this->addAction(wCM_SetToOne);
wCM_Modify = new QAction(tr("Modify Value"),this);
wCM_Modify->setShortcut(Qt::Key_Return);
wCM_Modify->setShortcut(QKeySequence(Qt::Key_Enter));
wCM_ToggleValue = new QAction(tr("Toggle"),this);
wCM_ToggleValue->setShortcut(Qt::Key_Space);
this->addAction(wCM_ToggleValue);
wCM_CopyToClipboard = new QAction(tr("Copy Value to Clipboard"),this);
wCM_CopyToClipboard->setShortcut(QKeySequence::Copy);
this->addAction(wCM_CopyToClipboard);
wCM_FollowInDisassembly = new QAction(tr("Follow in Disassembler"),this);
wCM_FollowInDump = new QAction(tr("Follow in Dump"),this);
wCM_FollowInStack = new QAction("Follow in Stack", this);
@ -221,6 +221,19 @@ RegistersView::RegistersView(QWidget * parent) : QAbstractScrollArea(parent), mV
connect(wCM_FollowInDisassembly,SIGNAL(triggered()),this,SLOT(onFollowInDisassembly()));
connect(wCM_FollowInDump,SIGNAL(triggered()),this,SLOT(onFollowInDump()));
connect(wCM_FollowInStack,SIGNAL(triggered()),this,SLOT(onFollowInStack()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void RegistersView::refreshShortcutsSlot()
{
wCM_Increment->setShortcut(QKeySequence(Qt::Key_Plus));
wCM_Decrement->setShortcut(QKeySequence(Qt::Key_Minus));
wCM_Zero->setShortcut(QKeySequence(Qt::Key_0));
wCM_SetToOne->setShortcut(QKeySequence(Qt::Key_1));
wCM_ToggleValue->setShortcut(QKeySequence(Qt::Key_Space));
wCM_CopyToClipboard->setShortcut(QKeySequence::Copy);
}
RegistersView::~RegistersView()
@ -332,34 +345,8 @@ void RegistersView::keyPressEvent(QKeyEvent *event)
{
if(!DbgIsDebugging())
return;
if(event->matches(QKeySequence::Copy))
{
wCM_CopyToClipboard->trigger();
return;
}
switch(event->key())
{
case Qt::Key_0:
wCM_Zero->trigger();
break;
case Qt::Key_1:
wCM_SetToOne->trigger();
break;
case Qt::Key_Plus:
wCM_Increment->trigger();
break;
case Qt::Key_Minus:
wCM_Decrement->trigger();
break;
case Qt::Key_Space:
wCM_ToggleValue->trigger();
break;
case Qt::Key_Return:
if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
wCM_Modify->trigger();
break;
default:
break;
}
}
void RegistersView::wheelEvent(QWheelEvent *event)
@ -567,12 +554,11 @@ void RegistersView::onToggleValueAction()
void RegistersView::onCopyToClipboardAction()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(QString("%1").arg(registerValue(&wRegDumpStruct,mSelected), mRegisterPlaces[mSelected].valuesize, 16, QChar('0')).toUpper());
clipboard->setText(QString("%1").arg((uint_t)registerValue(&wRegDumpStruct,mSelected), sizeof(int_t)*2, 16, QChar('0')).toUpper());
}
void RegistersView::onFollowInDisassembly()
{
if(mGPR.contains(mSelected))
{
QString addr = QString("%1").arg(registerValue(&wRegDumpStruct,mSelected), mRegisterPlaces[mSelected].valuesize, 16, QChar('0')).toUpper();

View File

@ -65,6 +65,7 @@ public:
QSize sizeHint() const;
public slots:
void refreshShortcutsSlot();
void updateRegistersSlot();
void displayCustomContextMenuSlot(QPoint pos);
void setRegister(REGISTER_NAME reg, uint_t value);

View File

@ -339,50 +339,42 @@ void ScriptView::setupContextMenu()
mScriptLoad = new QAction("Open...", this);
mScriptLoad->setShortcutContext(Qt::WidgetShortcut);
mScriptLoad->setShortcut(QKeySequence("ctrl+o"));
this->addAction(mScriptLoad);
connect(mScriptLoad, SIGNAL(triggered()), this, SLOT(openFile()));
mLoadMenu->addAction(mScriptLoad);
mScriptUnload = new QAction("Unload Script", this);
mScriptUnload->setShortcutContext(Qt::WidgetShortcut);
mScriptUnload->setShortcut(QKeySequence("ctrl+u"));
this->addAction(mScriptUnload);
connect(mScriptUnload, SIGNAL(triggered()), this, SLOT(unload()));
mScriptRun = new QAction("Run", this);
mScriptRun->setShortcutContext(Qt::WidgetShortcut);
mScriptRun->setShortcut(QKeySequence("space"));
this->addAction(mScriptRun);
connect(mScriptRun, SIGNAL(triggered()), this, SLOT(run()));
mScriptBpToggle = new QAction("Toggle BP", this);
mScriptBpToggle->setShortcutContext(Qt::WidgetShortcut);
mScriptBpToggle->setShortcut(QKeySequence("F2"));
this->addAction(mScriptBpToggle);
connect(mScriptBpToggle, SIGNAL(triggered()), this, SLOT(bpToggle()));
mScriptRunCursor = new QAction("Run until selection", this);
mScriptRunCursor->setShortcutContext(Qt::WidgetShortcut);
mScriptRunCursor->setShortcut(QKeySequence("F4"));
this->addAction(mScriptRunCursor);
connect(mScriptRunCursor, SIGNAL(triggered()), this, SLOT(runCursor()));
mScriptStep = new QAction("Step", this);
mScriptStep->setShortcutContext(Qt::WidgetShortcut);
mScriptStep->setShortcut(QKeySequence("tab"));
this->addAction(mScriptStep);
connect(mScriptStep, SIGNAL(triggered()), this, SLOT(step()));
mScriptAbort = new QAction("Abort", this);
mScriptAbort->setShortcutContext(Qt::WidgetShortcut);
mScriptAbort->setShortcut(QKeySequence("esc"));
this->addAction(mScriptAbort);
connect(mScriptAbort, SIGNAL(triggered()), this, SLOT(abort()));
mScriptCmdExec = new QAction("Execute Command...", this);
mScriptCmdExec->setShortcutContext(Qt::WidgetShortcut);
mScriptCmdExec->setShortcut(QKeySequence("x"));
this->addAction(mScriptCmdExec);
connect(mScriptCmdExec, SIGNAL(triggered()), this, SLOT(cmdExec()));
@ -390,6 +382,21 @@ void ScriptView::setupContextMenu()
mScriptNewIp->setShortcutContext(Qt::WidgetShortcut);
this->addAction(mScriptNewIp);
connect(mScriptNewIp, SIGNAL(triggered()), this, SLOT(newIp()));
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
void ScriptView::refreshShortcutsSlot()
{
mScriptLoad->setShortcut(QKeySequence("ctrl+o"));
mScriptUnload->setShortcut(QKeySequence("ctrl+u"));
mScriptRun->setShortcut(QKeySequence("space"));
mScriptBpToggle->setShortcut(QKeySequence("F2"));
mScriptRunCursor->setShortcut(QKeySequence("F4"));
mScriptStep->setShortcut(QKeySequence("tab"));
mScriptAbort->setShortcut(QKeySequence("esc"));
mScriptCmdExec->setShortcut(QKeySequence("x"));
}
bool ScriptView::isScriptCommand(QString text, QString cmd)

View File

@ -23,6 +23,7 @@ public:
void keyPressEvent(QKeyEvent* event);
public slots:
void refreshShortcutsSlot();
void contextMenuSlot(const QPoint &pos);
void add(int count, const char** lines);
void clear();