Add symbol online search to symbol view

This commit is contained in:
torusrxxx 2023-12-29 16:26:48 +08:00
parent b683fc6a59
commit 8cb5459629
No known key found for this signature in database
GPG Key ID: A795C73A0F1CFADD
3 changed files with 36 additions and 2 deletions

View File

@ -1883,7 +1883,7 @@ void CPUDisassembly::labelHelpSlot()
QString baseUrl(setting);
QString fullUrl = baseUrl.replace("@topic", topic);
if(fullUrl.startsWith("execute://"))
if(baseUrl.startsWith("execute://"))
{
QString command = fullUrl.right(fullUrl.length() - 10);
QProcess::execute(command);

View File

@ -7,7 +7,7 @@
#include "StdIconSearchListView.h"
#include "ZehSymbolTable.h"
#include "DisassemblyPopup.h"
#include <QDesktopServices>
#include <QVBoxLayout>
#include <QProcess>
#include <QFileDialog>
@ -321,6 +321,9 @@ void SymbolView::setupContextMenu()
mSymbolSearchList->addAction(mToggleBookmark);
connect(mToggleBookmark, SIGNAL(triggered()), this, SLOT(toggleBookmark()));
mLabelHelp = new QAction(DIcon("help"), tr("Help on Symbolic Name"), this);
connect(mLabelHelp, SIGNAL(triggered()), this, SLOT(labelHelpSlot()));
//Modules
mFollowModuleAction = new QAction(disassembler, tr("&Follow in Disassembler"), this);
mFollowModuleAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
@ -529,6 +532,7 @@ void SymbolView::symbolContextMenu(QMenu* menu)
menu->addAction(mFollowSymbolDumpAction);
if(mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), 1) == tr("Import"))
menu->addAction(mFollowSymbolImportAction);
menu->addAction(mLabelHelp);
menu->addSeparator();
menu->addAction(mToggleBreakpoint);
menu->addAction(mToggleBookmark);
@ -580,6 +584,34 @@ void SymbolView::symbolSelectModule(duint base)
}
}
void SymbolView::labelHelpSlot()
{
QString topic = mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), ZehSymbolTable::ColUndecorated);
if(topic.isEmpty())
topic = mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), ZehSymbolTable::ColDecorated);
if(topic.isEmpty())
return;
char setting[MAX_SETTING_SIZE] = "";
if(!BridgeSettingGet("Misc", "HelpOnSymbolicNameUrl", setting))
{
//"execute://winhlp32.exe -k@topic ..\\win32.hlp";
strcpy_s(setting, "https://www.google.com/search?q=@topic");
BridgeSettingSet("Misc", "HelpOnSymbolicNameUrl", setting);
}
QString baseUrl(setting);
QString fullUrl = baseUrl.replace("@topic", topic);
if(baseUrl.startsWith("execute://"))
{
QString command = fullUrl.right(fullUrl.length() - 10);
QProcess::execute(command);
}
else
{
QDesktopServices::openUrl(QUrl(fullUrl));
}
}
void SymbolView::enterPressedSlot()
{
auto addr = DbgValFromString(mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), 0).toUtf8().constData());

View File

@ -42,6 +42,7 @@ private slots:
void enterPressedSlot();
void symbolContextMenu(QMenu* menu);
void symbolRefreshCurrent();
void labelHelpSlot();
void moduleContextMenu(QMenu* menu);
void moduleFollow();
void moduleEntryFollow();
@ -90,6 +91,7 @@ private:
QAction* mFollowInMemMap;
QAction* mLoadLib;
QAction* mFreeLib;
QAction* mLabelHelp;
QMenu* mPluginMenu;
static void cbSymbolEnum(SYMBOLINFO* symbol, void* user);