diff --git a/src/dbg/debugger.cpp b/src/dbg/debugger.cpp index bc530406..a4e58ab1 100644 --- a/src/dbg/debugger.cpp +++ b/src/dbg/debugger.cpp @@ -391,19 +391,25 @@ void DebugUpdateGui(duint disasm_addr, bool stack) else sprintf_s(modtext, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Module: %s - ")), modname); char threadswitch[256] = ""; + DWORD currentThreadId = ThreadGetId(hActiveThread); { static DWORD PrevThreadId = 0; if(PrevThreadId == 0) PrevThreadId = fdProcessInfo->dwThreadId; // Initialize to Main Thread - DWORD currentThreadId = ThreadGetId(hActiveThread); if(currentThreadId != PrevThreadId) { - sprintf_s(threadswitch, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", " (switched from %X)")), PrevThreadId); + char threadName2[MAX_THREAD_NAME_SIZE] = ""; + if(!ThreadGetName(PrevThreadId, threadName2) || threadName2[0] == 0) + sprintf_s(threadName2, "%X", PrevThreadId); + sprintf_s(threadswitch, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", " (switched from %s)")), threadName2); PrevThreadId = currentThreadId; } } char title[1024] = ""; - sprintf_s(title, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "File: %s - PID: %X - %sThread: %X%s")), szBaseFileName, fdProcessInfo->dwProcessId, modtext, ThreadGetId(hActiveThread), threadswitch); + char threadName1[MAX_THREAD_NAME_SIZE] = ""; + if(!ThreadGetName(currentThreadId, threadName1) || threadName1[0] == 0) + sprintf_s(threadName1, "%X", currentThreadId); + sprintf_s(title, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "File: %s - PID: %X - %sThread: %s%s")), szBaseFileName, fdProcessInfo->dwProcessId, modtext, threadName1, threadswitch); GuiUpdateWindowTitle(title); GuiUpdateAllViews(); GuiFocusView(GUI_DISASSEMBLY); diff --git a/src/dbg/thread.cpp b/src/dbg/thread.cpp index 56d187d9..5e649f28 100644 --- a/src/dbg/thread.cpp +++ b/src/dbg/thread.cpp @@ -36,6 +36,8 @@ void ThreadCreate(CREATE_THREAD_DEBUG_INFO* CreateThread) // The first thread (#0) is always the main program thread if(curInfo.ThreadNumber <= 0) strcpy_s(curInfo.threadName, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Main Thread"))); + else + curInfo.threadName[0] = 0; // Modify global thread list EXCLUSIVE_ACQUIRE(LockThreads); @@ -240,6 +242,23 @@ bool ThreadSetName(DWORD ThreadId, const char* Name) return false; } +/** +@brief ThreadGetName Get the name of the thread. +@param ThreadId The id of the thread. +@param Name The returned name of the thread. Must be at least MAX_THREAD_NAME_SIZE size +@return True if the function succeeds. False otherwise. +*/ +bool ThreadGetName(DWORD ThreadId, char* Name) +{ + SHARED_ACQUIRE(LockThreads); + if(threadList.find(ThreadId) != threadList.end()) + { + strcpy_s(Name, MAX_THREAD_NAME_SIZE, threadList[ThreadId].threadName); + return true; + } + return false; +} + HANDLE ThreadGetHandle(DWORD ThreadId) { SHARED_ACQUIRE(LockThreads); diff --git a/src/dbg/thread.h b/src/dbg/thread.h index bb055142..65e5ac27 100644 --- a/src/dbg/thread.h +++ b/src/dbg/thread.h @@ -21,6 +21,7 @@ THREADWAITREASON ThreadGetWaitReason(HANDLE Thread); DWORD ThreadGetLastErrorTEB(ULONG_PTR ThreadLocalBase); DWORD ThreadGetLastError(DWORD ThreadId); bool ThreadSetName(DWORD dwThreadId, const char* name); +bool ThreadGetName(DWORD ThreadId, char* Name); HANDLE ThreadGetHandle(DWORD ThreadId); DWORD ThreadGetId(HANDLE Thread); int ThreadSuspendAll(); diff --git a/src/gui/Src/BasicView/StdTable.cpp b/src/gui/Src/BasicView/StdTable.cpp index 4d16683d..0f3c6dbc 100644 --- a/src/gui/Src/BasicView/StdTable.cpp +++ b/src/gui/Src/BasicView/StdTable.cpp @@ -34,14 +34,15 @@ QString StdTable::paintContent(QPainter* painter, dsint rowBase, int rowOffset, void StdTable::mouseMoveEvent(QMouseEvent* event) { bool wAccept = true; + int y = transY(event->y()); if(mGuiState == StdTable::MultiRowsSelectionState) { //qDebug() << "State = MultiRowsSelectionState"; - if((transY(event->y()) >= 0) && (transY(event->y()) <= this->getTableHeigth())) + if(y >= 0 && y <= this->getTableHeigth()) { - int wRowIndex = getTableOffset() + getIndexOffsetFromY(transY(event->y())); + int wRowIndex = getTableOffset() + getIndexOffsetFromY(y); if(wRowIndex < getRowCount()) { @@ -55,6 +56,14 @@ void StdTable::mouseMoveEvent(QMouseEvent* event) wAccept = false; } } + else if(y < 0) + { + verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub); + } + else if(y > getTableHeigth()) + { + verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd); + } } if(wAccept == true) diff --git a/src/gui/Src/Gui/CPUDisassembly.cpp b/src/gui/Src/Gui/CPUDisassembly.cpp index 5113b500..1b103271 100644 --- a/src/gui/Src/Gui/CPUDisassembly.cpp +++ b/src/gui/Src/Gui/CPUDisassembly.cpp @@ -507,6 +507,7 @@ void CPUDisassembly::setupRightClickContextMenu() mMenuBuilder->addSeparator(); mMenuBuilder->addAction(makeShortcutAction(DIcon("neworigin.png"), tr("Set New Origin Here"), SLOT(setNewOriginHereActionSlot()), "ActionSetNewOriginHere")); + mMenuBuilder->addAction(makeShortcutAction(tr("Create New Thread Here"), SLOT(createThreadSlot()), "ActionCreateNewThreadHere")); MenuBuilder* gotoMenu = new MenuBuilder(this); gotoMenu->addAction(makeShortcutAction(DIcon("cbp.png"), tr("Origin"), SLOT(gotoOriginSlot()), "ActionGotoOrigin")); @@ -1455,11 +1456,7 @@ void CPUDisassembly::decompileFunctionSlot() void CPUDisassembly::displayWarningSlot(QString title, QString text) { - QMessageBox msg(QMessageBox::Warning, title, text, QMessageBox::Ok); - msg.setParent(this, Qt::Dialog); - msg.setWindowIcon(DIcon("compile-warning.png")); - msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint)); - msg.exec(); + SimpleWarningBox(this, title, text); } void CPUDisassembly::paintEvent(QPaintEvent* event) @@ -1676,3 +1673,13 @@ void CPUDisassembly::analyzeModuleSlot() { DbgCmdExec("cfanal"); } + +void CPUDisassembly::createThreadSlot() +{ + WordEditDialog argWindow(this); + argWindow.setup(tr("Argument for the new thread"), 0, sizeof(duint)); + if(argWindow.exec() != QDialog::Accepted) + return; + duint addr = rvaToVa(getSelectionStart()); + DbgCmdExec(QString("createthread %1, %2").arg(ToPtrString(addr)).arg(ToPtrString(argWindow.getVal())).toUtf8().constData()); +} diff --git a/src/gui/Src/Gui/CPUDisassembly.h b/src/gui/Src/Gui/CPUDisassembly.h index e1d95220..79bcc36c 100644 --- a/src/gui/Src/Gui/CPUDisassembly.h +++ b/src/gui/Src/Gui/CPUDisassembly.h @@ -105,6 +105,7 @@ public slots: void graphSlot(); void analyzeModuleSlot(); void togglePreviewSlot(); + void createThreadSlot(); protected: void paintEvent(QPaintEvent* event); diff --git a/src/gui/Src/Gui/CPUStack.cpp b/src/gui/Src/Gui/CPUStack.cpp index 2c36bf78..182326b5 100644 --- a/src/gui/Src/Gui/CPUStack.cpp +++ b/src/gui/Src/Gui/CPUStack.cpp @@ -76,10 +76,14 @@ void CPUStack::setupContextMenu() { //Push mPushAction = new QAction(ArchValue(tr("P&ush DWORD..."), tr("P&ush QWORD...")), this); + mPushAction->setShortcutContext(Qt::WidgetShortcut); + this->addAction(mPushAction); connect(mPushAction, SIGNAL(triggered()), this, SLOT(pushSlot())); //Pop mPopAction = new QAction(ArchValue(tr("P&op DWORD"), tr("P&op QWORD")), this); + mPopAction->setShortcutContext(Qt::WidgetShortcut); + this->addAction(mPopAction); connect(mPopAction, SIGNAL(triggered()), this, SLOT(popSlot())); //Realign @@ -341,6 +345,8 @@ void CPUStack::refreshShortcutsSlot() mGotoExpression->setShortcut(ConfigShortcut("ActionGotoExpression")); mGotoPrevious->setShortcut(ConfigShortcut("ActionGotoPrevious")); mGotoNext->setShortcut(ConfigShortcut("ActionGotoNext")); + mPushAction->setShortcut(ConfigShortcut("ActionPush")); + mPopAction->setShortcut(ConfigShortcut("ActionPop")); } void CPUStack::getColumnRichText(int col, dsint rva, RichTextPainter::List & richText) diff --git a/src/gui/Src/Gui/FavouriteTools.cpp b/src/gui/Src/Gui/FavouriteTools.cpp index ddd92d4c..0b6eaf68 100644 --- a/src/gui/Src/Gui/FavouriteTools.cpp +++ b/src/gui/Src/Gui/FavouriteTools.cpp @@ -64,6 +64,8 @@ FavouriteTools::FavouriteTools(QWidget* parent) : connect(ui->listTools, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); connect(ui->listScript, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); connect(ui->listCommand, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); + connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); + emit ui->listTools->itemSelectionChanged(); } void FavouriteTools::setupTools(QString name, QTableWidget* list) @@ -325,8 +327,7 @@ void FavouriteTools::onListSelectionChanged() if(indexes.count() < 1) return; ui->shortcutEdit->setErrorState(false); - currentShortcut = QKeySequence(table->item(table->currentRow(), 1)->text()); - ui->shortcutEdit->setText(currentShortcut.toString(QKeySequence::NativeText)); + ui->shortcutEdit->setText(table->item(table->currentRow(), 1)->text()); } void FavouriteTools::on_shortcutEdit_askForSave() @@ -378,6 +379,30 @@ void FavouriteTools::on_shortcutEdit_askForSave() } } +void FavouriteTools::on_btnClearShortcut_clicked() +{ + QTableWidget* table; + switch(ui->tabWidget->currentIndex()) + { + case 0: + table = ui->listTools; + break; + case 1: + table = ui->listScript; + break; + case 2: + table = ui->listCommand; + break; + default: + return; + } + if(!table->rowCount()) + return; + QString emptyString; + ui->shortcutEdit->setText(emptyString); + table->item(table->currentRow(), 1)->setText(emptyString); +} + void FavouriteTools::on_btnOK_clicked() { for(int i = 1; i <= ui->listTools->rowCount(); i++) @@ -437,6 +462,22 @@ void FavouriteTools::on_btnOK_clicked() this->done(QDialog::Accepted); } +void FavouriteTools::tabChanged(int i) +{ + switch(i) + { + case 0: + emit ui->listTools->itemSelectionChanged(); + break; + case 1: + emit ui->listScript->itemSelectionChanged(); + break; + case 2: + emit ui->listCommand->itemSelectionChanged(); + break; + } +} + FavouriteTools::~FavouriteTools() { delete ui; diff --git a/src/gui/Src/Gui/FavouriteTools.h b/src/gui/Src/Gui/FavouriteTools.h index cbff815b..2e3620da 100644 --- a/src/gui/Src/Gui/FavouriteTools.h +++ b/src/gui/Src/Gui/FavouriteTools.h @@ -35,7 +35,9 @@ public slots: void on_btnRemoveFavouriteCommand_clicked(); void on_btnUpFavouriteCommand_clicked(); void on_btnDownFavouriteCommand_clicked(); + void on_btnClearShortcut_clicked(); void onListSelectionChanged(); + void tabChanged(int i); void on_shortcutEdit_askForSave(); void on_btnOK_clicked(); diff --git a/src/gui/Src/Gui/FavouriteTools.ui b/src/gui/Src/Gui/FavouriteTools.ui index 237c74d6..5a7b89d6 100644 --- a/src/gui/Src/Gui/FavouriteTools.ui +++ b/src/gui/Src/Gui/FavouriteTools.ui @@ -195,6 +195,13 @@ + + + + Clear + + + diff --git a/src/gui/Src/Gui/LogView.cpp b/src/gui/Src/Gui/LogView.cpp index b454d01c..510b3244 100644 --- a/src/gui/Src/Gui/LogView.cpp +++ b/src/gui/Src/Gui/LogView.cpp @@ -32,31 +32,23 @@ void LogView::updateStyle() setStyleSheet(QString("QTextEdit { color: %1; background-color: %2 }").arg(ConfigColor("AbstractTableViewTextColor").name(), ConfigColor("AbstractTableViewBackgroundColor").name())); } +template static QAction* setupAction(const QString & text, LogView* this_object, T slot) +{ + QAction* action = new QAction(text, this_object); + action->setShortcutContext(Qt::WidgetShortcut); + this_object->addAction(action); + this_object->connect(action, SIGNAL(triggered()), this_object, slot); + return action; +} + void LogView::setupContextMenu() { - actionClear = new QAction(tr("Clea&r"), this); - connect(actionClear, SIGNAL(triggered()), this, SLOT(clearLogSlot())); - actionClear->setShortcutContext(Qt::WidgetShortcut); - this->addAction(actionClear); - actionCopy = new QAction(tr("&Copy"), this); - connect(actionCopy, SIGNAL(triggered()), this, SLOT(copy())); - actionCopy->setShortcutContext(Qt::WidgetShortcut); - this->addAction(actionCopy); - actionSelectAll = new QAction(tr("Select &All"), this); - connect(actionSelectAll, SIGNAL(triggered()), this, SLOT(selectAll())); - actionSelectAll->setShortcutContext(Qt::WidgetShortcut); - this->addAction(actionSelectAll); - actionSave = new QAction(tr("&Save"), this); - actionSave->setShortcutContext(Qt::WidgetShortcut); - connect(actionSave, SIGNAL(triggered()), this, SLOT(saveSlot())); - this->addAction(actionSave); - actionToggleLogging = new QAction(tr("Disable &Logging"), this); - actionToggleLogging->setShortcutContext(Qt::WidgetShortcut); - connect(actionToggleLogging, SIGNAL(triggered()), this, SLOT(toggleLoggingSlot())); - this->addAction(actionToggleLogging); - actionRedirectLog = new QAction(tr("&Redirect Log..."), this); - connect(actionRedirectLog, SIGNAL(triggered()), this, SLOT(redirectLogSlot())); - this->addAction(actionRedirectLog); + actionClear = setupAction(tr("Clea&r"), this, SLOT(clearLogSlot())); + actionCopy = setupAction(tr("&Copy"), this, SLOT(copy())); + actionSelectAll = setupAction(tr("Select &All"), this, SLOT(selectAll())); + actionSave = setupAction(tr("&Save"), this, SLOT(saveSlot())); + actionToggleLogging = setupAction(tr("Disable &Logging"), this, SLOT(toggleLoggingSlot())); + actionRedirectLog = setupAction(tr("&Redirect Log..."), this, SLOT(redirectLogSlot())); refreshShortcutsSlot(); connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot())); @@ -66,6 +58,7 @@ void LogView::refreshShortcutsSlot() { actionCopy->setShortcut(ConfigShortcut("ActionCopy")); actionToggleLogging->setShortcut(ConfigShortcut("ActionToggleLogging")); + actionRedirectLog->setShortcut(ConfigShortcut("ActionRedirectLog")); } void LogView::contextMenuEvent(QContextMenuEvent* event) diff --git a/src/gui/Src/Gui/RegistersView.cpp b/src/gui/Src/Gui/RegistersView.cpp index 4c5d84db..2fb3100d 100644 --- a/src/gui/Src/Gui/RegistersView.cpp +++ b/src/gui/Src/Gui/RegistersView.cpp @@ -415,48 +415,48 @@ void RegistersView::InitMappings() mRowsNeeded = offset + 1; } +static QAction* setupAction(const QIcon & icon, const QString & text, RegistersView* this_object) +{ + QAction* action = new QAction(icon, text, this_object); + action->setShortcutContext(Qt::WidgetShortcut); + this_object->addAction(action); + return action; +} + +static QAction* setupAction(const QString & text, RegistersView* this_object) +{ + QAction* action = new QAction(text, this_object); + action->setShortcutContext(Qt::WidgetShortcut); + this_object->addAction(action); + return action; +} + RegistersView::RegistersView(CPUWidget* parent) : QScrollArea(parent), mVScrollOffset(0), mParent(parent) { mChangeViewButton = NULL; // precreate ContextMenu Actions - wCM_Increment = new QAction(DIcon("register_inc.png"), tr("Increment"), this); - wCM_Increment->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_Increment); - wCM_Decrement = new QAction(DIcon("register_dec.png"), tr("Decrement"), this); - wCM_Decrement->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_Decrement); - wCM_Zero = new QAction(DIcon("register_zero.png"), tr("Zero"), this); - wCM_Zero->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_Zero); - wCM_SetToOne = new QAction(DIcon("register_one.png"), tr("Set to 1"), this); - wCM_SetToOne->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_SetToOne); + wCM_Increment = setupAction(DIcon("register_inc.png"), tr("Increment"), this); + wCM_Decrement = setupAction(DIcon("register_dec.png"), tr("Decrement"), this); + wCM_Zero = setupAction(DIcon("register_zero.png"), tr("Zero"), this); + wCM_SetToOne = setupAction(DIcon("register_one.png"), tr("Set to 1"), this); wCM_Modify = new QAction(DIcon("register_edit.png"), tr("Modify value"), this); wCM_Modify->setShortcut(QKeySequence(Qt::Key_Enter)); - wCM_ToggleValue = new QAction(DIcon("register_toggle.png"), tr("Toggle"), this); - wCM_ToggleValue->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_ToggleValue); - wCM_CopyToClipboard = new QAction(DIcon("copy.png"), tr("Copy value to clipboard"), this); - wCM_CopyToClipboard->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_CopyToClipboard); - wCM_CopySymbolToClipboard = new QAction(DIcon("pdb.png"), tr("Copy Symbol Value to Clipboard"), this); - wCM_CopySymbolToClipboard->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_CopySymbolToClipboard); - wCM_CopyAll = new QAction(DIcon("copy-alt.png"), tr("Copy all registers"), this); - wCM_CopyAll->setShortcutContext(Qt::WidgetShortcut); - this->addAction(wCM_CopyAll); + wCM_ToggleValue = setupAction(DIcon("register_toggle.png"), tr("Toggle"), this); + wCM_CopyToClipboard = setupAction(DIcon("copy.png"), tr("Copy value to clipboard"), this); + wCM_CopySymbolToClipboard = setupAction(DIcon("pdb.png"), tr("Copy Symbol Value to Clipboard"), this); + wCM_CopyAll = setupAction(DIcon("copy-alt.png"), tr("Copy all registers"), this); wCM_FollowInDisassembly = new QAction(DIcon(QString("processor%1.png").arg(ArchValue("32", "64"))), tr("Follow in Disassembler"), this); wCM_FollowInDump = new QAction(DIcon("dump.png"), tr("Follow in Dump"), this); wCM_FollowInStack = new QAction(DIcon("stack.png"), tr("Follow in Stack"), this); - wCM_Incrementx87Stack = new QAction(DIcon("arrow-small-down.png"), tr("Increment x87 Stack"), this); - wCM_Decrementx87Stack = new QAction(DIcon("arrow-small-up.png"), tr("Decrement x87 Stack"), this); + wCM_Incrementx87Stack = setupAction(DIcon("arrow-small-down.png"), tr("Increment x87 Stack"), this); + wCM_Decrementx87Stack = setupAction(DIcon("arrow-small-up.png"), tr("Decrement x87 Stack"), this); wCM_ChangeFPUView = new QAction(DIcon("change-view.png"), tr("Change view"), this); - wCM_IncrementPtrSize = new QAction(ArchValue(tr("Increase 4"), tr("Increase 8")), this); - wCM_DecrementPtrSize = new QAction(ArchValue(tr("Decrease 4"), tr("Decrease 8")), this); - wCM_Push = new QAction(tr("Push"), this); - wCM_Pop = new QAction(tr("Pop"), this); - wCM_Highlight = new QAction(tr("Highlight"), this); + wCM_IncrementPtrSize = setupAction(ArchValue(tr("Increase 4"), tr("Increase 8")), this); + wCM_DecrementPtrSize = setupAction(ArchValue(tr("Decrease 4"), tr("Decrease 8")), this); + wCM_Push = setupAction(tr("Push"), this); + wCM_Pop = setupAction(tr("Pop"), this); + wCM_Highlight = setupAction(tr("Highlight"), this); // general purposes register (we allow the user to modify the value) mGPR.insert(CAX); @@ -1174,6 +1174,13 @@ void RegistersView::refreshShortcutsSlot() wCM_CopyToClipboard->setShortcut(ConfigShortcut("ActionCopy")); wCM_CopySymbolToClipboard->setShortcut(ConfigShortcut("ActionCopySymbol")); wCM_CopyAll->setShortcut(ConfigShortcut("ActionCopyAllRegisters")); + wCM_Highlight->setShortcut(ConfigShortcut("ActionHighlightingMode")); + wCM_IncrementPtrSize->setShortcut(ConfigShortcut("ActionIncreaseRegisterPtrSize")); + wCM_DecrementPtrSize->setShortcut(ConfigShortcut("ActionDecreaseRegisterPtrSize")); + wCM_Incrementx87Stack->setShortcut(ConfigShortcut("ActionIncrementx87Stack")); + wCM_Decrementx87Stack->setShortcut(ConfigShortcut("ActionDecrementx87Stack")); + wCM_Push->setShortcut(ConfigShortcut("ActionPush")); + wCM_Pop->setShortcut(ConfigShortcut("ActionPop")); } RegistersView::~RegistersView() diff --git a/src/gui/Src/Gui/ShortcutsDialog.cpp b/src/gui/Src/Gui/ShortcutsDialog.cpp index 2a6520a3..86d64cdb 100644 --- a/src/gui/Src/Gui/ShortcutsDialog.cpp +++ b/src/gui/Src/Gui/ShortcutsDialog.cpp @@ -40,6 +40,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent) : QDialog(parent), ui(new Ui:: ui->tblShortcuts->setItem(j, 0, shortcutName); ui->tblShortcuts->setItem(j, 1, shortcutKey); } + ui->tblShortcuts->setSortingEnabled(true); connect(ui->tblShortcuts, SIGNAL(itemSelectionChanged()), this, SLOT(syncTextfield())); connect(ui->shortcutEdit, SIGNAL(askForSave()), this, SLOT(updateShortcut())); @@ -93,6 +94,21 @@ void ShortcutsDialog::updateShortcut() } } } +void ShortcutsDialog::on_btnClearShortcut_clicked() +{ + for(QMap::iterator i = Config()->Shortcuts.begin(); i != Config()->Shortcuts.end(); ++i) + { + if(i.value().Name == currentShortcut.Name) + { + Config()->setShortcut(i.key(), QKeySequence()); + break; + } + } + QString emptyString; + ui->tblShortcuts->item(currentRow, 1)->setText(emptyString); + ui->shortcutEdit->setText(emptyString); + ui->shortcutEdit->setErrorState(false); +} void ShortcutsDialog::syncTextfield() { diff --git a/src/gui/Src/Gui/ShortcutsDialog.h b/src/gui/Src/Gui/ShortcutsDialog.h index da126573..8920a28a 100644 --- a/src/gui/Src/Gui/ShortcutsDialog.h +++ b/src/gui/Src/Gui/ShortcutsDialog.h @@ -26,6 +26,7 @@ protected slots: private slots: void on_btnSave_clicked(); + void on_btnClearShortcut_clicked(); void rejectedSlot(); private: diff --git a/src/gui/Src/Gui/ShortcutsDialog.ui b/src/gui/Src/Gui/ShortcutsDialog.ui index cdcc25ed..10480145 100644 --- a/src/gui/Src/Gui/ShortcutsDialog.ui +++ b/src/gui/Src/Gui/ShortcutsDialog.ui @@ -17,65 +17,61 @@ :/icons/images/shortcut.png:/icons/images/shortcut.png - - - - 10 - 20 - 601 - 281 - - - - - - - 10 - 310 - 601 - 51 - - - - Shortcut - - - - - 10 - 20 - 581 - 20 - - - - - - - - 460 - 370 - 75 - 23 - - - - &Save - - - - - - 540 - 370 - 75 - 23 - - - - &Cancel - - + + + + + + + + Shortcut + + + + + + + + + Clear + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Save + + + + + + + &Cancel + + + + + + diff --git a/src/gui/Src/Gui/SymbolView.cpp b/src/gui/Src/Gui/SymbolView.cpp index 6a71aaf1..1d87c9b1 100644 --- a/src/gui/Src/Gui/SymbolView.cpp +++ b/src/gui/Src/Gui/SymbolView.cpp @@ -133,15 +133,31 @@ void SymbolView::setupContextMenu() connect(mFollowModuleEntryAction, SIGNAL(triggered()), this, SLOT(moduleEntryFollow())); mDownloadSymbolsAction = new QAction(tr("&Download Symbols for This Module"), this); + mDownloadSymbolsAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); + this->addAction(mDownloadSymbolsAction); + mModuleList->mList->addAction(mDownloadSymbolsAction); + mModuleList->mSearchList->addAction(mDownloadSymbolsAction); connect(mDownloadSymbolsAction, SIGNAL(triggered()), this, SLOT(moduleDownloadSymbols())); mDownloadAllSymbolsAction = new QAction(tr("Download Symbols for &All Modules"), this); + mDownloadAllSymbolsAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); + this->addAction(mDownloadAllSymbolsAction); + mModuleList->mList->addAction(mDownloadAllSymbolsAction); + mModuleList->mSearchList->addAction(mDownloadAllSymbolsAction); connect(mDownloadAllSymbolsAction, SIGNAL(triggered()), this, SLOT(moduleDownloadAllSymbols())); mCopyPathAction = new QAction(tr("Copy File &Path"), this); + mCopyPathAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); + this->addAction(mCopyPathAction); + mModuleList->mList->addAction(mCopyPathAction); + mModuleList->mSearchList->addAction(mCopyPathAction); connect(mCopyPathAction, SIGNAL(triggered()), this, SLOT(moduleCopyPath())); mBrowseInExplorer = new QAction(tr("Browse in Explorer"), this); + mBrowseInExplorer->setShortcutContext(Qt::WidgetWithChildrenShortcut); + this->addAction(mBrowseInExplorer); + mModuleList->mList->addAction(mBrowseInExplorer); + mModuleList->mSearchList->addAction(mBrowseInExplorer); connect(mBrowseInExplorer, SIGNAL(triggered()), this, SLOT(moduleBrowse())); mYaraAction = new QAction(DIcon("yara.png"), tr("&Yara Memory..."), this); @@ -151,6 +167,10 @@ void SymbolView::setupContextMenu() connect(mYaraFileAction, SIGNAL(triggered()), this, SLOT(moduleYaraFile())); mEntropyAction = new QAction(DIcon("entropy.png"), tr("Entropy..."), this); + mEntropyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); + this->addAction(mEntropyAction); + mModuleList->mList->addAction(mEntropyAction); + mModuleList->mSearchList->addAction(mEntropyAction); connect(mEntropyAction, SIGNAL(triggered()), this, SLOT(moduleEntropy())); mModSetUserAction = new QAction(tr("Mark as &user module"), this); @@ -186,6 +206,11 @@ void SymbolView::refreshShortcutsSlot() mModSetUserAction->setShortcut(ConfigShortcut("ActionMarkAsUser")); mModSetSystemAction->setShortcut(ConfigShortcut("ActionMarkAsSystem")); mModSetPartyAction->setShortcut(ConfigShortcut("ActionMarkAsParty")); + mEntropyAction->setShortcut(ConfigShortcut("ActionEntropy")); + mBrowseInExplorer->setShortcut(ConfigShortcut("ActionBrowseInExplorer")); + mDownloadSymbolsAction->setShortcut(ConfigShortcut("ActionDownloadSymbol")); + mDownloadAllSymbolsAction->setShortcut(ConfigShortcut("ActionDownloadAllSymbol")); + mCopyPathAction->setShortcut(ConfigShortcut("ActionCopy")); } void SymbolView::updateStyle() diff --git a/src/gui/Src/Utils/Configuration.cpp b/src/gui/Src/Utils/Configuration.cpp index 99ae78d1..2b4360cd 100644 --- a/src/gui/Src/Utils/Configuration.cpp +++ b/src/gui/Src/Utils/Configuration.cpp @@ -412,6 +412,8 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false) defaultShortcuts.insert("ActionTreatSelectionAsYMMWord", Shortcut(tr("Actions -> Treat Selection As YMMWord"), "")); defaultShortcuts.insert("ActionIncreaseRegister", Shortcut(tr("Actions -> Increase Register"), "+")); defaultShortcuts.insert("ActionDecreaseRegister", Shortcut(tr("Actions -> Decrease Register"), "-")); + defaultShortcuts.insert("ActionIncreaseRegisterPtrSize", Shortcut(tr("Actions -> Increase Register by") + ArchValue(QString(" 4"), QString(" 8")))); + defaultShortcuts.insert("ActionDecreaseRegisterPtrSize", Shortcut(tr("Actions -> Decrease Register by") + ArchValue(QString(" 4"), QString(" 8")))); defaultShortcuts.insert("ActionZeroRegister", Shortcut(tr("Actions -> Zero Register"), "0")); defaultShortcuts.insert("ActionSetOneRegister", Shortcut(tr("Actions -> Set Register to One"), "1")); defaultShortcuts.insert("ActionToggleRegisterValue", Shortcut(tr("Actions -> Toggle Register Value"), "Space")); @@ -430,6 +432,15 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false) defaultShortcuts.insert("ActionRefresh", Shortcut(tr("Actions -> Refresh"), "F5")); defaultShortcuts.insert("ActionGraph", Shortcut(tr("Actions -> Graph"), "G")); defaultShortcuts.insert("ActionGraphToggleOverview", Shortcut(tr("Actions -> Graph -> Toggle overview"), "O")); + defaultShortcuts.insert("ActionIncrementx87Stack", Shortcut(tr("Actions -> Increment x87 Stack"))); + defaultShortcuts.insert("ActionDecrementx87Stack", Shortcut(tr("Actions -> Decrement x87 Stack"))); + defaultShortcuts.insert("ActionPush", Shortcut(tr("Actions -> Push"))); + defaultShortcuts.insert("ActionPop", Shortcut(tr("Actions -> Pop"))); + defaultShortcuts.insert("ActionRedirectLog", Shortcut(tr("Actions -> Redirect Log"))); + defaultShortcuts.insert("ActionBrowseInExplorer", Shortcut(tr("Actions -> Browse in Explorer"))); + defaultShortcuts.insert("ActionDownloadSymbol", Shortcut(tr("Actions -> Download Symbols for This Module"))); + defaultShortcuts.insert("ActionDownloadAllSymbol", Shortcut(tr("Actions -> Download Symbols for All Modules"))); + defaultShortcuts.insert("ActionCreateNewThreadHere", Shortcut(tr("Actions -> Create New Thread Here"))); Shortcuts = defaultShortcuts;