mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Rename PseudoCode widget to Decompiler (#1728)
This commit is contained in:
parent
806de0b341
commit
1d692db261
@ -287,7 +287,7 @@ SOURCES += \
|
|||||||
common/TempConfig.cpp \
|
common/TempConfig.cpp \
|
||||||
common/SvgIconEngine.cpp \
|
common/SvgIconEngine.cpp \
|
||||||
common/SyntaxHighlighter.cpp \
|
common/SyntaxHighlighter.cpp \
|
||||||
widgets/PseudocodeWidget.cpp \
|
widgets/DecompilerWidget.cpp \
|
||||||
widgets/VisualNavbar.cpp \
|
widgets/VisualNavbar.cpp \
|
||||||
widgets/GraphView.cpp \
|
widgets/GraphView.cpp \
|
||||||
dialogs/preferences/PreferencesDialog.cpp \
|
dialogs/preferences/PreferencesDialog.cpp \
|
||||||
@ -415,7 +415,7 @@ HEADERS += \
|
|||||||
common/TempConfig.h \
|
common/TempConfig.h \
|
||||||
common/SvgIconEngine.h \
|
common/SvgIconEngine.h \
|
||||||
common/SyntaxHighlighter.h \
|
common/SyntaxHighlighter.h \
|
||||||
widgets/PseudocodeWidget.h \
|
widgets/DecompilerWidget.h \
|
||||||
widgets/VisualNavbar.h \
|
widgets/VisualNavbar.h \
|
||||||
widgets/GraphView.h \
|
widgets/GraphView.h \
|
||||||
dialogs/preferences/PreferencesDialog.h \
|
dialogs/preferences/PreferencesDialog.h \
|
||||||
@ -524,7 +524,7 @@ FORMS += \
|
|||||||
dialogs/preferences/AppearanceOptionsWidget.ui \
|
dialogs/preferences/AppearanceOptionsWidget.ui \
|
||||||
dialogs/preferences/GraphOptionsWidget.ui \
|
dialogs/preferences/GraphOptionsWidget.ui \
|
||||||
widgets/QuickFilterView.ui \
|
widgets/QuickFilterView.ui \
|
||||||
widgets/PseudocodeWidget.ui \
|
widgets/DecompilerWidget.ui \
|
||||||
widgets/ClassesWidget.ui \
|
widgets/ClassesWidget.ui \
|
||||||
widgets/VTablesWidget.ui \
|
widgets/VTablesWidget.ui \
|
||||||
widgets/TypesWidget.ui \
|
widgets/TypesWidget.ui \
|
||||||
|
10
src/Main.cpp
10
src/Main.cpp
@ -35,7 +35,7 @@ static bool migrateSettingsPre18(QSettings &newSettings)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CUTTER_SETTINGS_VERSION_CURRENT 1
|
#define CUTTER_SETTINGS_VERSION_CURRENT 2
|
||||||
#define CUTTER_SETTINGS_VERSION_KEY "version"
|
#define CUTTER_SETTINGS_VERSION_KEY "version"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -52,6 +52,12 @@ static void migrateSettingsTo1(QSettings &settings) {
|
|||||||
settings.remove("updated_custom_themes"); // now handled by theme_version
|
settings.remove("updated_custom_themes"); // now handled by theme_version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void migrateSettingsTo2(QSettings &settings) {
|
||||||
|
QStringList docks = settings.value("docks").toStringList(); // get current list of docks
|
||||||
|
// replace occurences of "PseudocodeWidget" with "DecompilerWidget"
|
||||||
|
settings.setValue("docks", docks.replaceInStrings("PseudocodeWidget", "DecompilerWidget"));
|
||||||
|
}
|
||||||
|
|
||||||
static void initializeSettings()
|
static void initializeSettings()
|
||||||
{
|
{
|
||||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
@ -71,6 +77,8 @@ static void initializeSettings()
|
|||||||
switch (v) {
|
switch (v) {
|
||||||
case 1:
|
case 1:
|
||||||
migrateSettingsTo1(settings); break;
|
migrateSettingsTo1(settings); break;
|
||||||
|
case 2:
|
||||||
|
migrateSettingsTo2(settings);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
#include "widgets/RegistersWidget.h"
|
#include "widgets/RegistersWidget.h"
|
||||||
#include "widgets/BacktraceWidget.h"
|
#include "widgets/BacktraceWidget.h"
|
||||||
#include "widgets/HexdumpWidget.h"
|
#include "widgets/HexdumpWidget.h"
|
||||||
#include "widgets/PseudocodeWidget.h"
|
#include "widgets/DecompilerWidget.h"
|
||||||
#include "widgets/HexWidget.h"
|
#include "widgets/HexWidget.h"
|
||||||
|
|
||||||
// Qt Headers
|
// Qt Headers
|
||||||
@ -266,7 +266,7 @@ void MainWindow::initToolBar()
|
|||||||
void MainWindow::initDocks()
|
void MainWindow::initDocks()
|
||||||
{
|
{
|
||||||
dockWidgets.reserve(20);
|
dockWidgets.reserve(20);
|
||||||
pseudocodeDock = new PseudocodeWidget(this, ui->actionPseudocode);
|
decompilerDock = new DecompilerWidget(this, ui->actionDecompiler);
|
||||||
consoleDock = new ConsoleWidget(this, ui->actionConsole);
|
consoleDock = new ConsoleWidget(this, ui->actionConsole);
|
||||||
|
|
||||||
overviewDock = new OverviewWidget(this, ui->actionOverview);
|
overviewDock = new OverviewWidget(this, ui->actionOverview);
|
||||||
@ -780,7 +780,7 @@ void MainWindow::restoreDocks()
|
|||||||
|
|
||||||
// Function | Dashboard
|
// Function | Dashboard
|
||||||
splitDockWidget(functionsDock, dashboardDock, Qt::Horizontal);
|
splitDockWidget(functionsDock, dashboardDock, Qt::Horizontal);
|
||||||
tabifyDockWidget(dashboardDock, pseudocodeDock);
|
tabifyDockWidget(dashboardDock, decompilerDock);
|
||||||
tabifyDockWidget(dashboardDock, entrypointDock);
|
tabifyDockWidget(dashboardDock, entrypointDock);
|
||||||
tabifyDockWidget(dashboardDock, flagsDock);
|
tabifyDockWidget(dashboardDock, flagsDock);
|
||||||
tabifyDockWidget(dashboardDock, stringsDock);
|
tabifyDockWidget(dashboardDock, stringsDock);
|
||||||
@ -953,8 +953,8 @@ MemoryDockWidget *MainWindow::addNewMemoryWidget(MemoryWidgetType type, RVA addr
|
|||||||
case MemoryWidgetType::Disassembly:
|
case MemoryWidgetType::Disassembly:
|
||||||
memoryWidget = new DisassemblyWidget(this);
|
memoryWidget = new DisassemblyWidget(this);
|
||||||
break;
|
break;
|
||||||
case MemoryWidgetType::Pseudocode:
|
case MemoryWidgetType::Decompiler:
|
||||||
memoryWidget = new PseudocodeWidget(this);
|
memoryWidget = new DecompilerWidget(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto seekable = memoryWidget->getSeekable();
|
auto seekable = memoryWidget->getSeekable();
|
||||||
|
@ -48,7 +48,7 @@ class QDockWidget;
|
|||||||
class DisassemblyWidget;
|
class DisassemblyWidget;
|
||||||
class GraphWidget;
|
class GraphWidget;
|
||||||
class HexdumpWidget;
|
class HexdumpWidget;
|
||||||
class PseudocodeWidget;
|
class DecompilerWidget;
|
||||||
class OverviewWidget;
|
class OverviewWidget;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -221,7 +221,7 @@ private:
|
|||||||
|
|
||||||
QList<QDockWidget *> dockWidgets;
|
QList<QDockWidget *> dockWidgets;
|
||||||
QMultiMap<QAction *, QDockWidget *> dockWidgetsOfAction;
|
QMultiMap<QAction *, QDockWidget *> dockWidgetsOfAction;
|
||||||
PseudocodeWidget *pseudocodeDock = nullptr;
|
DecompilerWidget *decompilerDock = nullptr;
|
||||||
OverviewWidget *overviewDock = nullptr;
|
OverviewWidget *overviewDock = nullptr;
|
||||||
EntrypointWidget *entrypointDock = nullptr;
|
EntrypointWidget *entrypointDock = nullptr;
|
||||||
FunctionsWidget *functionsDock = nullptr;
|
FunctionsWidget *functionsDock = nullptr;
|
||||||
|
@ -149,7 +149,7 @@
|
|||||||
<addaction name="actionDashboard"/>
|
<addaction name="actionDashboard"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFunctions"/>
|
<addaction name="actionFunctions"/>
|
||||||
<addaction name="actionPseudocode"/>
|
<addaction name="actionDecompiler"/>
|
||||||
<addaction name="actionOverview"/>
|
<addaction name="actionOverview"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionSearch"/>
|
<addaction name="actionSearch"/>
|
||||||
@ -838,7 +838,7 @@
|
|||||||
<string>Show ESIL rather than assembly</string>
|
<string>Show ESIL rather than assembly</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDisplay_Pseudocode">
|
<action name="actionDisplay_Decompiler">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -896,12 +896,12 @@
|
|||||||
<string>Graph Overview</string>
|
<string>Graph Overview</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionPseudocode">
|
<action name="actionDecompiler">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Pseudocode</string>
|
<string>Decompiler</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionConsole">
|
<action name="actionConsole">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "PseudocodeWidget.h"
|
#include "DecompilerWidget.h"
|
||||||
#include "ui_PseudocodeWidget.h"
|
#include "ui_DecompilerWidget.h"
|
||||||
#include "menus/DisassemblyContextMenu.h"
|
#include "menus/DisassemblyContextMenu.h"
|
||||||
|
|
||||||
#include "common/Configuration.h"
|
#include "common/Configuration.h"
|
||||||
@ -14,10 +14,10 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTextBlockUserData>
|
#include <QTextBlockUserData>
|
||||||
|
|
||||||
PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
DecompilerWidget::DecompilerWidget(MainWindow *main, QAction *action) :
|
||||||
MemoryDockWidget(MemoryWidgetType::Pseudocode, main, action),
|
MemoryDockWidget(MemoryWidgetType::Decompiler, main, action),
|
||||||
mCtxMenu(new DisassemblyContextMenu(this, main)),
|
mCtxMenu(new DisassemblyContextMenu(this, main)),
|
||||||
ui(new Ui::PseudocodeWidget)
|
ui(new Ui::DecompilerWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
|||||||
if (dec->getId() == selectedDecompilerId) {
|
if (dec->getId() == selectedDecompilerId) {
|
||||||
ui->decompilerComboBox->setCurrentIndex(ui->decompilerComboBox->count() - 1);
|
ui->decompilerComboBox->setCurrentIndex(ui->decompilerComboBox->count() - 1);
|
||||||
}
|
}
|
||||||
connect(dec, &Decompiler::finished, this, &PseudocodeWidget::decompilationFinished);
|
connect(dec, &Decompiler::finished, this, &DecompilerWidget::decompilationFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
decompilerSelectionEnabled = decompilers.size() > 1;
|
decompilerSelectionEnabled = decompilers.size() > 1;
|
||||||
@ -66,44 +66,44 @@ PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
|||||||
ui->textEdit->setPlainText(tr("No Decompiler available."));
|
ui->textEdit->setPlainText(tr("No Decompiler available."));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->decompilerComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &PseudocodeWidget::decompilerSelected);
|
connect(ui->decompilerComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DecompilerWidget::decompilerSelected);
|
||||||
connectCursorPositionChanged(false);
|
connectCursorPositionChanged(false);
|
||||||
connect(Core(), &CutterCore::seekChanged, this, &PseudocodeWidget::seekChanged);
|
connect(Core(), &CutterCore::seekChanged, this, &DecompilerWidget::seekChanged);
|
||||||
ui->textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->textEdit, SIGNAL(customContextMenuRequested(const QPoint &)),
|
connect(ui->textEdit, SIGNAL(customContextMenuRequested(const QPoint &)),
|
||||||
this, SLOT(showDisasContextMenu(const QPoint &)));
|
this, SLOT(showDisasContextMenu(const QPoint &)));
|
||||||
|
|
||||||
// refresh the widget when an action in this menu is triggered
|
// refresh the widget when an action in this menu is triggered
|
||||||
connect(mCtxMenu, &QMenu::triggered, this, &PseudocodeWidget::refreshPseudocode);
|
connect(mCtxMenu, &QMenu::triggered, this, &DecompilerWidget::refreshDecompiler);
|
||||||
addActions(mCtxMenu->actions());
|
addActions(mCtxMenu->actions());
|
||||||
|
|
||||||
ui->progressLabel->setVisible(false);
|
ui->progressLabel->setVisible(false);
|
||||||
doRefresh(RVA_INVALID);
|
doRefresh(RVA_INVALID);
|
||||||
|
|
||||||
connect(Core(), &CutterCore::refreshAll, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::refreshAll, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::functionRenamed, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::functionRenamed, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::varsChanged, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::varsChanged, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::functionsChanged, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::functionsChanged, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::flagsChanged, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::flagsChanged, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::commentsChanged, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::commentsChanged, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::instructionChanged, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::instructionChanged, this, &DecompilerWidget::doAutoRefresh);
|
||||||
connect(Core(), &CutterCore::refreshCodeViews, this, &PseudocodeWidget::doAutoRefresh);
|
connect(Core(), &CutterCore::refreshCodeViews, this, &DecompilerWidget::doAutoRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
PseudocodeWidget::~PseudocodeWidget() = default;
|
DecompilerWidget::~DecompilerWidget() = default;
|
||||||
|
|
||||||
Decompiler *PseudocodeWidget::getCurrentDecompiler()
|
Decompiler *DecompilerWidget::getCurrentDecompiler()
|
||||||
{
|
{
|
||||||
return Core()->getDecompilerById(ui->decompilerComboBox->currentData().toString());
|
return Core()->getDecompilerById(ui->decompilerComboBox->currentData().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::setAutoRefresh(bool enabled)
|
void DecompilerWidget::setAutoRefresh(bool enabled)
|
||||||
{
|
{
|
||||||
autoRefreshEnabled = enabled;
|
autoRefreshEnabled = enabled;
|
||||||
updateRefreshButton();
|
updateRefreshButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::doAutoRefresh()
|
void DecompilerWidget::doAutoRefresh()
|
||||||
{
|
{
|
||||||
if (!autoRefreshEnabled) {
|
if (!autoRefreshEnabled) {
|
||||||
return;
|
return;
|
||||||
@ -111,7 +111,7 @@ void PseudocodeWidget::doAutoRefresh()
|
|||||||
doRefresh();
|
doRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::updateRefreshButton()
|
void DecompilerWidget::updateRefreshButton()
|
||||||
{
|
{
|
||||||
Decompiler *dec = getCurrentDecompiler();
|
Decompiler *dec = getCurrentDecompiler();
|
||||||
ui->refreshButton->setEnabled(!autoRefreshEnabled && dec && !dec->isRunning());
|
ui->refreshButton->setEnabled(!autoRefreshEnabled && dec && !dec->isRunning());
|
||||||
@ -122,7 +122,7 @@ void PseudocodeWidget::updateRefreshButton()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::doRefresh(RVA addr)
|
void DecompilerWidget::doRefresh(RVA addr)
|
||||||
{
|
{
|
||||||
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
||||||
return;
|
return;
|
||||||
@ -143,7 +143,7 @@ void PseudocodeWidget::doRefresh(RVA addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (addr == RVA_INVALID) {
|
if (addr == RVA_INVALID) {
|
||||||
ui->textEdit->setPlainText(tr("Click Refresh to generate Pseudocode from current offset."));
|
ui->textEdit->setPlainText(tr("Click Refresh to generate Decompiler from current offset."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,12 +157,12 @@ void PseudocodeWidget::doRefresh(RVA addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::refreshPseudocode()
|
void DecompilerWidget::refreshDecompiler()
|
||||||
{
|
{
|
||||||
doRefresh();
|
doRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::decompilationFinished(AnnotatedCode code)
|
void DecompilerWidget::decompilationFinished(AnnotatedCode code)
|
||||||
{
|
{
|
||||||
ui->progressLabel->setVisible(false);
|
ui->progressLabel->setVisible(false);
|
||||||
ui->decompilerComboBox->setEnabled(decompilerSelectionEnabled);
|
ui->decompilerComboBox->setEnabled(decompilerSelectionEnabled);
|
||||||
@ -185,7 +185,7 @@ void PseudocodeWidget::decompilationFinished(AnnotatedCode code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::decompilerSelected()
|
void DecompilerWidget::decompilerSelected()
|
||||||
{
|
{
|
||||||
Config()->setSelectedDecompiler(ui->decompilerComboBox->currentData().toString());
|
Config()->setSelectedDecompiler(ui->decompilerComboBox->currentData().toString());
|
||||||
if (autoRefreshEnabled) {
|
if (autoRefreshEnabled) {
|
||||||
@ -193,16 +193,16 @@ void PseudocodeWidget::decompilerSelected()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::connectCursorPositionChanged(bool disconnect)
|
void DecompilerWidget::connectCursorPositionChanged(bool disconnect)
|
||||||
{
|
{
|
||||||
if (disconnect) {
|
if (disconnect) {
|
||||||
QObject::disconnect(ui->textEdit, &QPlainTextEdit::cursorPositionChanged, this, &PseudocodeWidget::cursorPositionChanged);
|
QObject::disconnect(ui->textEdit, &QPlainTextEdit::cursorPositionChanged, this, &DecompilerWidget::cursorPositionChanged);
|
||||||
} else {
|
} else {
|
||||||
connect(ui->textEdit, &QPlainTextEdit::cursorPositionChanged, this, &PseudocodeWidget::cursorPositionChanged);
|
connect(ui->textEdit, &QPlainTextEdit::cursorPositionChanged, this, &DecompilerWidget::cursorPositionChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::cursorPositionChanged()
|
void DecompilerWidget::cursorPositionChanged()
|
||||||
{
|
{
|
||||||
size_t pos = ui->textEdit->textCursor().position();
|
size_t pos = ui->textEdit->textCursor().position();
|
||||||
RVA offset = code.OffsetForPosition(pos);
|
RVA offset = code.OffsetForPosition(pos);
|
||||||
@ -215,7 +215,7 @@ void PseudocodeWidget::cursorPositionChanged()
|
|||||||
updateSelection();
|
updateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::seekChanged()
|
void DecompilerWidget::seekChanged()
|
||||||
{
|
{
|
||||||
if (seekFromCursor) {
|
if (seekFromCursor) {
|
||||||
return;
|
return;
|
||||||
@ -232,7 +232,7 @@ void PseudocodeWidget::seekChanged()
|
|||||||
updateCursorPosition();
|
updateCursorPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::updateCursorPosition()
|
void DecompilerWidget::updateCursorPosition()
|
||||||
{
|
{
|
||||||
RVA offset = Core()->getOffset();
|
RVA offset = Core()->getOffset();
|
||||||
size_t pos = code.PositionForOffset(offset);
|
size_t pos = code.PositionForOffset(offset);
|
||||||
@ -247,13 +247,13 @@ void PseudocodeWidget::updateCursorPosition()
|
|||||||
connectCursorPositionChanged(false);
|
connectCursorPositionChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::setupFonts()
|
void DecompilerWidget::setupFonts()
|
||||||
{
|
{
|
||||||
QFont font = Config()->getFont();
|
QFont font = Config()->getFont();
|
||||||
ui->textEdit->setFont(font);
|
ui->textEdit->setFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::updateSelection()
|
void DecompilerWidget::updateSelection()
|
||||||
{
|
{
|
||||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||||
|
|
||||||
@ -270,21 +270,21 @@ void PseudocodeWidget::updateSelection()
|
|||||||
mCtxMenu->setCurHighlightedWord(searchString);
|
mCtxMenu->setCurHighlightedWord(searchString);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PseudocodeWidget::getWindowTitle() const
|
QString DecompilerWidget::getWindowTitle() const
|
||||||
{
|
{
|
||||||
return tr("Pseudocode");
|
return tr("Decompiler");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::fontsUpdated()
|
void DecompilerWidget::fontsUpdated()
|
||||||
{
|
{
|
||||||
setupFonts();
|
setupFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::colorsUpdatedSlot()
|
void DecompilerWidget::colorsUpdatedSlot()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::showDisasContextMenu(const QPoint &pt)
|
void DecompilerWidget::showDisasContextMenu(const QPoint &pt)
|
||||||
{
|
{
|
||||||
mCtxMenu->exec(ui->textEdit->mapToGlobal(pt));
|
mCtxMenu->exec(ui->textEdit->mapToGlobal(pt));
|
||||||
doRefresh();
|
doRefresh();
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef PSEUDOCODEWIDGET_H
|
#ifndef DECOMPILERWIDGET_H
|
||||||
#define PSEUDOCODEWIDGET_H
|
#define DECOMPILERWIDGET_H
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include "Decompiler.h"
|
#include "Decompiler.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PseudocodeWidget;
|
class DecompilerWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
@ -17,29 +17,29 @@ class QTextCursor;
|
|||||||
class DisassemblyContextMenu;
|
class DisassemblyContextMenu;
|
||||||
struct DecompiledCodeTextLine;
|
struct DecompiledCodeTextLine;
|
||||||
|
|
||||||
class PseudocodeWidget : public MemoryDockWidget
|
class DecompilerWidget : public MemoryDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
protected:
|
||||||
DisassemblyContextMenu *mCtxMenu;
|
DisassemblyContextMenu *mCtxMenu;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PseudocodeWidget(MainWindow *main, QAction *action = nullptr);
|
explicit DecompilerWidget(MainWindow *main, QAction *action = nullptr);
|
||||||
~PseudocodeWidget();
|
~DecompilerWidget();
|
||||||
public slots:
|
public slots:
|
||||||
void showDisasContextMenu(const QPoint &pt);
|
void showDisasContextMenu(const QPoint &pt);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fontsUpdated();
|
void fontsUpdated();
|
||||||
void colorsUpdatedSlot();
|
void colorsUpdatedSlot();
|
||||||
void refreshPseudocode();
|
void refreshDecompiler();
|
||||||
void decompilerSelected();
|
void decompilerSelected();
|
||||||
void cursorPositionChanged();
|
void cursorPositionChanged();
|
||||||
void seekChanged();
|
void seekChanged();
|
||||||
void decompilationFinished(AnnotatedCode code);
|
void decompilationFinished(AnnotatedCode code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::PseudocodeWidget> ui;
|
std::unique_ptr<Ui::DecompilerWidget> ui;
|
||||||
|
|
||||||
RefreshDeferrer *refreshDeferrer;
|
RefreshDeferrer *refreshDeferrer;
|
||||||
|
|
||||||
@ -72,4 +72,4 @@ private:
|
|||||||
QString getWindowTitle() const override;
|
QString getWindowTitle() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PSEUDOCODEWIDGET_H
|
#endif // DECOMPILERWIDGET_H
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>PseudocodeWidget</class>
|
<class>DecompilerWidget</class>
|
||||||
<widget class="QDockWidget" name="PseudocodeWidget">
|
<widget class="QDockWidget" name="DecompilerWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Pseudocode</string>
|
<string>Decompiler</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
class CutterSeekable;
|
class CutterSeekable;
|
||||||
|
|
||||||
/* Disassembly/Graph/Hexdump/Pseudocode view priority */
|
/* Disassembly/Graph/Hexdump/Decompiler view priority */
|
||||||
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Pseudocode };
|
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Decompiler };
|
||||||
|
|
||||||
class MemoryDockWidget : public CutterDockWidget
|
class MemoryDockWidget : public CutterDockWidget
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user