diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 194e5f52..31ca4ae1 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -40,7 +40,7 @@ #include "utils/Helpers.h" #include "dialogs/NewFileDialog.h" -#include "widgets/MemoryWidget.h" +#include "widgets/PreviewWidget.h" #include "widgets/FunctionsWidget.h" #include "widgets/SectionsWidget.h" #include "widgets/CommentsWidget.h" @@ -85,7 +85,7 @@ static void registerCustomFonts() MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), core(CutterCore::getInstance()), - memoryDock(nullptr), + previewDock(nullptr), notepadDock(nullptr), asmDock(nullptr), calcDock(nullptr), @@ -184,16 +184,22 @@ void MainWindow::initUI() dockWidgets.reserve(14); // Add Memory DockWidget - this->memoryDock = new MemoryWidget(); - dockWidgets.push_back(memoryDock); + this->previewDock = new PreviewWidget(tr("Preview"), this); + dockWidgets.push_back(previewDock); // To use in the future when we handle more than one memory views - // this->memoryDock->setAttribute(Qt::WA_DeleteOnClose); + // this->previewDock->setAttribute(Qt::WA_DeleteOnClose); // this->add_debug_output( QString::number(this->dockList.length()) ); // Add disassembly view (dockable) - this->disassemblyDock = new DisassemblyView(tr("Disassembly"), this); + this->disassemblyDock = new DisassemblyWidget(tr("Disassembly"), this); dockWidgets.push_back(disassemblyDock); + sidebarDock = new SidebarWidget(tr("Sidebar"), this); + dockWidgets.push_back(sidebarDock); + + hexdumpDock = new HexdumpWidget(tr("Hexdump"), this); + dockWidgets.push_back(hexdumpDock); + // Add graph view as dockable graphDock = new QDockWidget(tr("Graph"), this); graphDock->setAllowedAreas(Qt::AllDockWidgetAreas); @@ -244,7 +250,7 @@ void MainWindow::initUI() // Add Notepad Dock panel this->notepadDock = new Notepad(this); dockWidgets.push_back(notepadDock); - connect(memoryDock, SIGNAL(fontChanged(QFont)), notepadDock, SLOT(setFonts(QFont))); + connect(previewDock, SIGNAL(fontChanged(QFont)), notepadDock, SLOT(setFonts(QFont))); //Add Dashboard Dock panel this->dashboardDock = new Dashboard(this); @@ -341,8 +347,6 @@ void MainWindow::finalizeOpen() core->cmd("fs sections"); updateFrames(); - memoryDock->selectHexPreview(); - // Restore project notes QString notes = this->core->cmd("Pnj"); //qDebug() << "Notes:" << notes; @@ -367,7 +371,7 @@ void MainWindow::finalizeOpen() addOutput(tr(" > Finished, happy reversing :)")); // Add fortune message addOutput("\n" + core->cmd("fo")); - memoryDock->setWindowTitle("entry0"); + //previewDock->setWindowTitle("entry0"); start_web_server(); showMaximized(); // Initialize syntax highlighters @@ -408,11 +412,6 @@ void MainWindow::setWebServerState(bool start) } } -void MainWindow::raiseMemoryDock() -{ - memoryDock->raise(); -} - void MainWindow::toggleSideBarTheme() { sideBar->themesButtonToggle(); @@ -477,7 +476,7 @@ void MainWindow::readSettings() void MainWindow::dark() { qApp->setStyleSheet("QPlainTextEdit { background-color: rgb(64, 64, 64); color: rgb(222, 222, 222);} QTextEdit { background-color: rgb(64, 64, 64); color: rgb(222, 222, 222);} "); - this->memoryDock->switchTheme(true); + this->previewDock->switchTheme(true); QSettings settings; settings.setValue("dark", true); } @@ -485,7 +484,7 @@ void MainWindow::dark() void MainWindow::def_theme() { qApp->setStyleSheet(""); - this->memoryDock->switchTheme(false); + this->previewDock->switchTheme(false); QSettings settings; settings.setValue("dark", false); } @@ -606,27 +605,24 @@ void MainWindow::on_actionTabs_triggered() if (ui->centralTabWidget->tabPosition() == QTabWidget::South) { ui->centralTabWidget->setTabPosition(QTabWidget::North); - this->memoryDock->memTabWidget->setTabPosition(QTabWidget::North); this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); } else { ui->centralTabWidget->setTabPosition(QTabWidget::South); - this->memoryDock->memTabWidget->setTabPosition(QTabWidget::South); this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South); } } void MainWindow::on_actionMem_triggered() { - //this->memoryDock->show(); - //this->memoryDock->raise(); - MemoryWidget *newMemDock = new MemoryWidget(); + //this->previewDock->show(); + //this->previewDock->raise(); + PreviewWidget *newMemDock = new PreviewWidget(); this->dockWidgets << newMemDock; newMemDock->setAttribute(Qt::WA_DeleteOnClose); - this->tabifyDockWidget(this->memoryDock, newMemDock); + this->tabifyDockWidget(this->previewDock, newMemDock); //newMemDock->refreshDisasm(); - newMemDock->refreshHexdump(); } void MainWindow::on_actionEntry_points_triggered() @@ -763,8 +759,10 @@ void MainWindow::restoreDocks() addDockWidget(Qt::TopDockWidgetArea, this->dashboardDock); this->tabifyDockWidget(this->sectionsDock, this->commentsDock); this->tabifyDockWidget(this->dashboardDock, this->disassemblyDock); + this->tabifyDockWidget(this->dashboardDock, this->sidebarDock); + this->tabifyDockWidget(this->dashboardDock, this->hexdumpDock); this->tabifyDockWidget(this->dashboardDock, this->graphDock); - this->tabifyDockWidget(this->dashboardDock, this->memoryDock); + this->tabifyDockWidget(this->dashboardDock, this->previewDock); this->tabifyDockWidget(this->dashboardDock, this->entrypointDock); this->tabifyDockWidget(this->dashboardDock, this->flagsDock); this->tabifyDockWidget(this->dashboardDock, this->stringsDock); @@ -799,7 +797,7 @@ void MainWindow::showDefaultDocks() const QList defaultDocks = { sectionsDock, entrypointDock, functionsDock, - memoryDock, + previewDock, commentsDock, stringsDock, importsDock, @@ -807,6 +805,8 @@ void MainWindow::showDefaultDocks() notepadDock, graphDock, disassemblyDock, + sidebarDock, + hexdumpDock, dashboardDock }; @@ -895,7 +895,7 @@ void MainWindow::on_actionWhite_Theme_triggered() void MainWindow::on_actionSDB_browser_triggered() { this->sdbDock = new SdbDock(this); - this->tabifyDockWidget(this->memoryDock, this->sdbDock); + this->tabifyDockWidget(this->previewDock, this->sdbDock); this->sdbDock->setFloating(true); this->sdbDock->show(); } diff --git a/src/MainWindow.h b/src/MainWindow.h index ddbe98c8..6061aaa7 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -5,13 +5,15 @@ #include #include #include "RadareWebServer.h" -#include "widgets/DisassemblyView.h" +#include "widgets/DisassemblyWidget.h" +#include "widgets/SidebarWidget.h" +#include "widgets/HexdumpWidget.h" #include "cutter.h" // only needed for ut64 class CutterCore; class DockWidget; class Omnibar; -class MemoryWidget; +class PreviewWidget; class Notepad; class SideBar; class Highlighter; @@ -58,10 +60,9 @@ public: void saveProject(); void start_web_server(); - void closeEvent(QCloseEvent *event); + void closeEvent(QCloseEvent *event) override; void readSettings(); void setFilename(const QString &fn); - void seek(RVA offset); void updateFrames(); void refreshFunctions(); void refreshComments(); @@ -69,7 +70,6 @@ public: void addDebugOutput(const QString &msg); void sendToNotepad(const QString &txt); void setWebServerState(bool start); - void raiseMemoryDock(); void toggleSideBarTheme(); void refreshOmniBar(const QStringList &flags); @@ -170,13 +170,15 @@ private slots: private: CutterCore *core; - DisassemblyView *disassemblyDock; + DisassemblyWidget *disassemblyDock; + SidebarWidget *sidebarDock; + HexdumpWidget *hexdumpDock; QDockWidget *graphDock; QDockWidget *asmDock; QDockWidget *calcDock; Omnibar *omnibar; SideBar *sideBar; - MemoryWidget *memoryDock; + PreviewWidget *previewDock; Notepad *notepadDock; bool doLock; diff --git a/src/cutter.cpp b/src/cutter.cpp index ef625b8f..4fc727b6 100644 --- a/src/cutter.cpp +++ b/src/cutter.cpp @@ -390,6 +390,13 @@ void CutterCore::seek(ut64 offset) } +RVA CutterCore::getSeekAddr() +{ + return cmd("s").toULongLong(nullptr, 16); +} + + + bool CutterCore::tryFile(QString path, bool rw) { diff --git a/src/cutter.h b/src/cutter.h index 13aaca13..6ecb40ba 100644 --- a/src/cutter.h +++ b/src/cutter.h @@ -210,6 +210,8 @@ public: void analyze(int level, QList advanced); void seek(QString addr); void seek(ut64 offset); + RVA getSeekAddr(); + ut64 math(const QString &expr); QString itoa(ut64 num, int rdx = 16); diff --git a/src/cutter.pro b/src/cutter.pro index 686f888f..f2374e51 100644 --- a/src/cutter.pro +++ b/src/cutter.pro @@ -35,7 +35,7 @@ SOURCES += \ main.cpp \ cutter.cpp \ widgets/DisassemblerGraphView.cpp \ - widgets/MemoryWidget.cpp \ + widgets/PreviewWidget.cpp \ utils/RichTextPainter.cpp \ dialogs/OptionsDialog.cpp \ dialogs/AboutDialog.cpp \ @@ -74,12 +74,14 @@ SOURCES += \ widgets/StringsWidget.cpp \ widgets/SymbolsWidget.cpp \ menus/DisassemblyContextMenu.cpp \ - widgets/DisassemblyView.cpp + widgets/DisassemblyWidget.cpp \ + widgets/SidebarWidget.cpp \ + widgets/HexdumpWidget.cpp HEADERS += \ cutter.h \ widgets/DisassemblerGraphView.h \ - widgets/MemoryWidget.h \ + widgets/PreviewWidget.h \ utils/RichTextPainter.h \ utils/CachedFontMetrics.h \ dialogs/AboutDialog.h \ @@ -121,10 +123,12 @@ HEADERS += \ widgets/StringsWidget.h \ widgets/SymbolsWidget.h \ menus/DisassemblyContextMenu.h \ - widgets/DisassemblyView.h + widgets/DisassemblyWidget.h \ + widgets/SidebarWidget.h \ + widgets/HexdumpWidget.h FORMS += \ - widgets/MemoryWidget.ui \ + widgets/PreviewWidget.ui \ dialogs/AboutDialog.ui \ dialogs/AsmOptionsDialog.ui \ dialogs/CommentsDialog.ui \ @@ -149,7 +153,9 @@ FORMS += \ widgets/SectionsDock.ui \ widgets/Sidebar.ui \ widgets/StringsWidget.ui \ - widgets/SymbolsWidget.ui + widgets/SymbolsWidget.ui \ + widgets/SidebarWidget.ui \ + widgets/HexdumpWidget.ui RESOURCES += \ resources.qrc diff --git a/src/dialogs/OptionsDialog.cpp b/src/dialogs/OptionsDialog.cpp index 0927dfe2..c2e2d89d 100644 --- a/src/dialogs/OptionsDialog.cpp +++ b/src/dialogs/OptionsDialog.cpp @@ -5,7 +5,7 @@ #include "utils/Helpers.h" // TODO: remove us -#include "widgets/MemoryWidget.h" +#include "widgets/PreviewWidget.h" #include "widgets/Notepad.h" #include "Settings.h" diff --git a/src/widgets/DisassemblyView.cpp b/src/widgets/DisassemblyWidget.cpp similarity index 93% rename from src/widgets/DisassemblyView.cpp rename to src/widgets/DisassemblyWidget.cpp index d63f6fbf..2a19fc5d 100644 --- a/src/widgets/DisassemblyView.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -1,4 +1,4 @@ -#include "DisassemblyView.h" +#include "DisassemblyWidget.h" #include "menus/DisassemblyContextMenu.h" #include "dialogs/XrefsDialog.h" #include "utils/HexAsciiHighlighter.h" @@ -6,13 +6,14 @@ #include #include -DisassemblyView::DisassemblyView(QWidget *parent) : +DisassemblyWidget::DisassemblyWidget(QWidget *parent) : QDockWidget(parent), mDisasTextEdit(new QTextEdit(this)) { // Configure Dock - this->setWidget(mDisasTextEdit); - this->setAllowedAreas(Qt::AllDockWidgetAreas); + setWidget(mDisasTextEdit); + setAllowedAreas(Qt::AllDockWidgetAreas); + setObjectName("DisassemblyWidget"); // TODO Use Settings mDisasTextEdit->setFont(QFont("Monospace", 10)); @@ -67,12 +68,12 @@ DisassemblyView::DisassemblyView(QWidget *parent) : connect(CutterCore::getInstance(), SIGNAL(seekChanged(RVA)), this, SLOT(on_seekChanged(RVA))); } -DisassemblyView::DisassemblyView(const QString &title, QWidget *parent) : - DisassemblyView(parent) +DisassemblyWidget::DisassemblyWidget(const QString &title, QWidget *parent) : + DisassemblyWidget(parent) { this->setWindowTitle(title); } -void DisassemblyView::highlightCurrentLine() +void DisassemblyWidget::highlightCurrentLine() { QList extraSelections; @@ -131,13 +132,13 @@ void DisassemblyView::highlightCurrentLine() mDisasTextEdit->setExtraSelections(extraSelections); } -void DisassemblyView::showDisasContextMenu(const QPoint &pt) +void DisassemblyWidget::showDisasContextMenu(const QPoint &pt) { DisassemblyContextMenu menu(this->readCurrentDisassemblyOffset(), mDisasTextEdit); menu.exec(mDisasTextEdit->mapToGlobal(pt)); } -void DisassemblyView::showXrefsDialog() +void DisassemblyWidget::showXrefsDialog() { // Get current offset QTextCursor tc = mDisasTextEdit->textCursor(); @@ -153,7 +154,7 @@ void DisassemblyView::showXrefsDialog() } } -RVA DisassemblyView::readCurrentDisassemblyOffset() +RVA DisassemblyWidget::readCurrentDisassemblyOffset() { // TODO: do this in a different way without parsing the disassembly text QTextCursor tc = mDisasTextEdit->textCursor(); @@ -171,7 +172,7 @@ RVA DisassemblyView::readCurrentDisassemblyOffset() return ele.toULongLong(0, 16); } -bool DisassemblyView::loadMoreDisassembly() +bool DisassemblyWidget::loadMoreDisassembly() { /* * Add more disasm as the user scrolls @@ -251,12 +252,12 @@ bool DisassemblyView::loadMoreDisassembly() } -void DisassemblyView::disasmScrolled() +void DisassemblyWidget::disasmScrolled() { loadMoreDisassembly(); } -void DisassemblyView::refreshDisasm() +void DisassemblyWidget::refreshDisasm() { // TODO Very slow mostly because of the highlight // Prevent further scroll @@ -289,7 +290,7 @@ void DisassemblyView::refreshDisasm() this->highlightDisasms(); } -void DisassemblyView::on_mDisasTextEdit_cursorPositionChanged() +void DisassemblyWidget::on_mDisasTextEdit_cursorPositionChanged() { // Get current offset QTextCursor tc = mDisasTextEdit->textCursor(); @@ -344,15 +345,15 @@ void DisassemblyView::on_mDisasTextEdit_cursorPositionChanged() // Refresh function information at sidebar ui->fcnNameEdit->setText(at); // FIXME TITLE? - // this->main->memoryDock->setWindowTitle(at); - //this->main->memoryDock->create_graph(ele); + // this->main->previewDock->setWindowTitle(at); + //this->main->previewDock->create_graph(ele); this->setMiniGraph(at); } } */ } -bool DisassemblyView::eventFilter(QObject *obj, QEvent *event) +bool DisassemblyWidget::eventFilter(QObject *obj, QEvent *event) { if ((obj == mDisasTextEdit || obj == mDisasTextEdit->viewport()) && event->type() == QEvent::MouseButtonDblClick) { @@ -388,13 +389,13 @@ bool DisassemblyView::eventFilter(QObject *obj, QEvent *event) return QDockWidget::eventFilter(obj, event); } -void DisassemblyView::on_seekChanged(RVA offset) +void DisassemblyWidget::on_seekChanged(RVA offset) { Q_UNUSED(offset); refreshDisasm(); } -void DisassemblyView::highlightDisasms() +void DisassemblyWidget::highlightDisasms() { // Syntax Highliting // TODO doing new all the time diff --git a/src/widgets/DisassemblyView.h b/src/widgets/DisassemblyWidget.h similarity index 77% rename from src/widgets/DisassemblyView.h rename to src/widgets/DisassemblyWidget.h index d7c1188e..7bbc08ed 100644 --- a/src/widgets/DisassemblyView.h +++ b/src/widgets/DisassemblyWidget.h @@ -5,12 +5,12 @@ #include #include "cutter.h" -class DisassemblyView : public QDockWidget +class DisassemblyWidget : public QDockWidget { Q_OBJECT public: - explicit DisassemblyView(QWidget *parent = nullptr); - explicit DisassemblyView(const QString &title, QWidget *parent = nullptr); + explicit DisassemblyWidget(QWidget *parent = nullptr); + explicit DisassemblyWidget(const QString &title, QWidget *parent = nullptr); signals: diff --git a/src/widgets/MemoryWidget.cpp b/src/widgets/HexdumpWidget.cpp similarity index 54% rename from src/widgets/MemoryWidget.cpp rename to src/widgets/HexdumpWidget.cpp index 51189ebd..0f2213e9 100644 --- a/src/widgets/MemoryWidget.cpp +++ b/src/widgets/HexdumpWidget.cpp @@ -1,5 +1,6 @@ -#include "MemoryWidget.h" -#include "ui_MemoryWidget.h" + +#include "HexdumpWidget.h" +#include "ui_HexdumpWidget.h" #include "DisassemblerGraphView.h" #include "MainWindow.h" @@ -20,25 +21,17 @@ #include -MemoryWidget::MemoryWidget() : - ui(new Ui::MemoryWidget), - core(CutterCore::getInstance()) +HexdumpWidget::HexdumpWidget(QWidget *parent, Qt::WindowFlags flags) : + QDockWidget(parent, flags), + ui(new Ui::HexdumpWidget), + core(CutterCore::getInstance()) { ui->setupUi(this); this->hexOffsetText = ui->hexOffsetText_2; this->hexHexText = ui->hexHexText_2; - this->hexDisasTextEdit = ui->hexDisasTextEdit_2; this->hexASCIIText = ui->hexASCIIText_2; - this->xrefToTreeWidget_2 = ui->xrefToTreeWidget_2; - this->xreFromTreeWidget_2 = ui->xreFromTreeWidget_2; - this->memTabWidget = ui->memTabWidget; - this->last_fcn = "entry0"; - this->last_graph_fcn = 0; //""; - this->last_hexdump_fcn = 0; //""; - - disasm_top_offset = 0; - next_disasm_top_offset = 0; + this->hexDisasTextEdit = ui->hexDisasTextEdit_2; //this->on_actionSettings_menu_1_triggered(); @@ -46,29 +39,6 @@ MemoryWidget::MemoryWidget() : //connect(ui->hexHexText, SIGNAL(cursorPositionChanged()), this, SLOT(highlightHexCurrentLine())); //highlightHexCurrentLine(); - // Highlight current line on previews and decompiler - connect(ui->previewTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(highlightPreviewCurrentLine())); - connect(ui->decoTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(highlightDecoCurrentLine())); - - // Hide memview notebooks tabs - QTabBar *bar = ui->memTabWidget->tabBar(); - bar->setVisible(false); - QTabBar *sidebar = ui->memSideTabWidget_2->tabBar(); - sidebar->setVisible(false); - QTabBar *preTab = ui->memPreviewTab->tabBar(); - preTab->setVisible(false); - - // Hide fcn graph notebooks tabs - QTabBar *graph_bar = ui->fcnGraphTabWidget->tabBar(); - graph_bar->setVisible(false); - - // Debug console - // For QWebEngine debugging see: https://doc.qt.io/qt-5/qtwebengine-debugging.html - //QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - - // Add margin to function name line edit - ui->fcnNameEdit->setTextMargins(5, 0, 0, 0); - // Normalize fonts for other OS qhelpers::normalizeEditFont(this->hexOffsetText); qhelpers::normalizeEditFont(this->hexHexText); @@ -80,10 +50,6 @@ MemoryWidget::MemoryWidget() : memMenu->addAction(ui->actionSettings_menu_1); ui->memSettingsButton_2->setMenu(memMenu); - // Set Splitter stretch factor - ui->splitter->setStretchFactor(0, 10); - ui->splitter->setStretchFactor(1, 1); - // Set hexdump context menu ui->hexHexText_2->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->hexHexText_2, SIGNAL(customContextMenuRequested(const QPoint &)), @@ -108,39 +74,32 @@ MemoryWidget::MemoryWidget() : connect(ui->hexASCIIText_2->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->hexHexText_2->verticalScrollBar(), SLOT(setValue(int))); - // Space to switch between disassembly and graph - QShortcut *graph_shortcut = new QShortcut(QKeySequence(Qt::Key_Space), this); - connect(graph_shortcut, SIGNAL(activated()), this, SLOT(cycleViews())); - //graph_shortcut->setContext(Qt::WidgetShortcut); - // Control Disasm and Hex scroll to add more contents connect(this->hexASCIIText->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hexScrolled())); connect(core, SIGNAL(seekChanged(RVA)), this, SLOT(on_seekChanged(RVA))); - //connect(main, SIGNAL(cursorAddressChanged(RVA)), this, SLOT(on_cursorAddressChanged(RVA))); - connect(core, SIGNAL(flagsChanged()), this, SLOT(updateViews())); - connect(core, SIGNAL(commentsChanged()), this, SLOT(updateViews())); - connect(core, SIGNAL(asmOptionsChanged()), this, SLOT(updateViews())); fillPlugins(); } - -void MemoryWidget::on_seekChanged(RVA addr) +HexdumpWidget::HexdumpWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) + : HexdumpWidget(parent, flags) { - updateViews(addr); + setWindowTitle(title); } -void MemoryWidget::on_cursorAddressChanged(RVA addr) + +void HexdumpWidget::on_seekChanged(RVA addr) { - setFcnName(addr); - get_refs_data(addr); + refresh(addr); } +HexdumpWidget::~HexdumpWidget() {} + /* * Text highlight functions */ -void MemoryWidget::highlightHexCurrentLine() +void HexdumpWidget::highlightHexCurrentLine() { QList extraSelections; @@ -173,7 +132,7 @@ void MemoryWidget::highlightHexCurrentLine() highlightHexWords(cursor.selectedText()); } -void MemoryWidget::highlightHexWords(const QString &str) +void HexdumpWidget::highlightHexWords(const QString &str) { QString searchString = str; QTextDocument *document = ui->hexHexText_2->document(); @@ -204,89 +163,13 @@ void MemoryWidget::highlightHexWords(const QString &str) cursor.endEditBlock(); } -void MemoryWidget::highlightPreviewCurrentLine() +void HexdumpWidget::refresh(RVA addr) { - - QList extraSelections; - - if (ui->previewTextEdit->toPlainText() != "") + if (addr == RVA_INVALID) { - if (ui->previewTextEdit->isReadOnly()) - { - QTextEdit::ExtraSelection selection; - - QColor lineColor = QColor(190, 144, 212); - - selection.format.setBackground(lineColor); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = ui->previewTextEdit->textCursor(); - selection.cursor.clearSelection(); - extraSelections.append(selection); - } + addr = core->getSeekAddr(); } - ui->previewTextEdit->setExtraSelections(extraSelections); -} -void MemoryWidget::highlightDecoCurrentLine() -{ - - QList extraSelections; - - if (ui->decoTextEdit->toPlainText() != "") - { - if (ui->decoTextEdit->isReadOnly()) - { - QTextEdit::ExtraSelection selection; - - QColor lineColor = QColor(190, 144, 212); - - selection.format.setBackground(lineColor); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = ui->decoTextEdit->textCursor(); - selection.cursor.clearSelection(); - extraSelections.append(selection); - } - } - ui->decoTextEdit->setExtraSelections(extraSelections); -} - -MemoryWidget::~MemoryWidget() {} - -void MemoryWidget::setup() -{ - setScrollMode(); - - const QString off = core->cmd("afo entry0").trimmed(); - RVA offset = off.toULongLong(0, 16); - updateViews(offset); - - //refreshDisasm(); - //refreshHexdump(off); - //create_graph(off); - get_refs_data(offset); - //setFcnName(off); -} - -void MemoryWidget::refresh() -{ - setScrollMode(); - - // TODO: honor the offset - updateViews(RVA_INVALID); -} - -/* - * Content management functions - */ - -void MemoryWidget::fillPlugins() -{ - // Fill the plugins combo for the hexdump sidebar - ui->hexArchComboBox_2->insertItems(0, core->getAsmPluginNames()); -} - -void MemoryWidget::refreshHexdump(const QString &where) -{ RCoreLocked lcore = this->core->core(); // Prevent further scroll disconnect(this->hexASCIIText->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hexScrolled())); @@ -314,15 +197,8 @@ void MemoryWidget::refreshHexdump(const QString &where) QString s = ""; - if (!where.isEmpty()) - { - this->core->cmd("ss " + where); - } - // Add first the hexdump at block size -- - this->core->cmd("ss-" + this->core->itoa(hexdumpLength)); - //s = this->normalize_addr(this->core->cmd("s")); - QList ret = this->get_hexdump(""); + QList ret = this->get_hexdump(RAddressString(addr - hexdumpLength)); hexdumpBottomOffset = lcore->offset; this->hexOffsetText->setPlainText(ret[0]); @@ -330,12 +206,9 @@ void MemoryWidget::refreshHexdump(const QString &where) this->hexASCIIText->setPlainText(ret[2]); this->resizeHexdump(); - // Add then the hexdump at block size ++ - this->core->cmd("ss+" + this->core->itoa(hexdumpLength)); // Get address to move cursor to later - //QString s = "0x0" + this->core->cmd("s").split("0x")[1].trimmed(); s = this->normalize_addr(this->core->cmd("s")); - ret = this->get_hexdump(""); + ret = this->get_hexdump(RAddressString(addr)); hexdumpBottomOffset = lcore->offset; this->hexOffsetText->append(ret[0]); @@ -353,9 +226,20 @@ void MemoryWidget::refreshHexdump(const QString &where) this->hexOffsetText->moveCursor(QTextCursor::EndOfLine, QTextCursor::MoveAnchor); connect(this->hexASCIIText->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hexScrolled())); + } -QList MemoryWidget::get_hexdump(const QString &offset) +/* + * Content management functions + */ + +void HexdumpWidget::fillPlugins() +{ + // Fill the plugins combo for the hexdump sidebar + ui->hexArchComboBox_2->insertItems(0, core->getAsmPluginNames()); +} + +QList HexdumpWidget::get_hexdump(const QString &offset) { RCoreLocked lcore = this->core->core(); QList ret; @@ -403,17 +287,17 @@ QList MemoryWidget::get_hexdump(const QString &offset) { switch (wc++) { - case 0: - offsets += a + "\n"; - break; - case 1: - { - hex += a.trimmed() + "\n"; - } - break; - case 2: - ascii += a + "\n"; - break; + case 0: + offsets += a + "\n"; + break; + case 1: + { + hex += a.trimmed() + "\n"; + } + break; + case 2: + ascii += a + "\n"; + break; } } } @@ -424,14 +308,14 @@ QList MemoryWidget::get_hexdump(const QString &offset) return ret; } -void MemoryWidget::resizeHexdump() +void HexdumpWidget::resizeHexdump() { this->hexOffsetText->setMinimumWidth(this->hexOffsetText->document()->size().width()); this->hexHexText->setMinimumWidth(this->hexHexText->document()->size().width()); this->hexASCIIText->setMinimumWidth(this->hexASCIIText->document()->size().width()); } -void MemoryWidget::hexScrolled() +void HexdumpWidget::hexScrolled() { RCoreLocked lcore = this->core->core(); QScrollBar *sb = this->hexASCIIText->verticalScrollBar(); @@ -527,7 +411,7 @@ void MemoryWidget::hexScrolled() } } -void MemoryWidget::on_hexHexText_2_selectionChanged() +void HexdumpWidget::on_hexHexText_2_selectionChanged() { // Get selected partsing type QString parsing = ui->codeCombo_2->currentText(); @@ -566,7 +450,7 @@ void MemoryWidget::on_hexHexText_2_selectionChanged() //qDebug() << "Selected Bits: " << bits; //qDebug() << "Selected Text: " << sel_text; } - // TODO: update on selection changes.. use cmd("pc "+len+"@"+off) + // TODO: update on selection changes.. use cmd("pc "+len+"@"+off) else if (parsing == "C byte array") { this->hexDisasTextEdit->setPlainText(this->core->cmd("pc@x:" + sel_text)); @@ -609,12 +493,12 @@ void MemoryWidget::on_hexHexText_2_selectionChanged() } } -void MemoryWidget::on_hexArchComboBox_2_currentTextChanged(const QString &/*arg1*/) +void HexdumpWidget::on_hexArchComboBox_2_currentTextChanged(const QString &/*arg1*/) { on_hexHexText_2_selectionChanged(); } -void MemoryWidget::on_hexBitsComboBox_2_currentTextChanged(const QString &/*arg1*/) +void HexdumpWidget::on_hexBitsComboBox_2_currentTextChanged(const QString &/*arg1*/) { on_hexHexText_2_selectionChanged(); } @@ -623,7 +507,7 @@ void MemoryWidget::on_hexBitsComboBox_2_currentTextChanged(const QString &/*arg1 * Context menu functions */ -void MemoryWidget::showHexdumpContextMenu(const QPoint &pt) +void HexdumpWidget::showHexdumpContextMenu(const QPoint &pt) { // Set Hexdump popup menu QMenu *menu = ui->hexHexText_2->createStandardContextMenu(); @@ -650,7 +534,7 @@ void MemoryWidget::showHexdumpContextMenu(const QPoint &pt) delete menu; } -void MemoryWidget::showHexASCIIContextMenu(const QPoint &pt) +void HexdumpWidget::showHexASCIIContextMenu(const QPoint &pt) { // Set Hex ASCII popup menu QMenu *menu = ui->hexASCIIText_2->createStandardContextMenu(); @@ -676,61 +560,11 @@ void MemoryWidget::showHexASCIIContextMenu(const QPoint &pt) menu->exec(ui->hexASCIIText_2->mapToGlobal(pt)); delete menu; } - -void MemoryWidget::on_showInfoButton_2_clicked() -{ - if (ui->showInfoButton_2->isChecked()) - { - ui->fcnGraphTabWidget->hide(); - ui->showInfoButton_2->setArrowType(Qt::RightArrow); - } - else - { - ui->fcnGraphTabWidget->show(); - ui->showInfoButton_2->setArrowType(Qt::DownArrow); - } -} - -void MemoryWidget::on_offsetToolButton_clicked() -{ - if (ui->offsetToolButton->isChecked()) - { - ui->offsetTreeWidget->hide(); - ui->offsetToolButton->setArrowType(Qt::RightArrow); - } - else - { - ui->offsetTreeWidget->show(); - ui->offsetToolButton->setArrowType(Qt::DownArrow); - } -} - -/* - * Show widgets - */ - -void MemoryWidget::cycleViews() -{ - switch (ui->memTabWidget->currentIndex()) - { - case 0: - // Show hexdump - ui->hexButton->setChecked(true); - on_hexButton_clicked(); - break; - case 1: - // Show disasm - ui->disasButton->setChecked(true); - on_disasButton_clicked(); - break; - } -} - /* * Actions callback functions */ -void MemoryWidget::on_actionSettings_menu_1_triggered() +void HexdumpWidget::on_actionSettings_menu_1_triggered() { bool ok = true; @@ -746,7 +580,7 @@ void MemoryWidget::on_actionSettings_menu_1_triggered() } } -void MemoryWidget::setFonts(QFont font) +void HexdumpWidget::setFonts(QFont font) { //ui->disasTextEdit_2->setFont(font); // the user clicked OK and font is set to the font the user selected @@ -754,23 +588,9 @@ void MemoryWidget::setFonts(QFont font) ui->hexOffsetText_2->setFont(font); ui->hexHexText_2->setFont(font); ui->hexASCIIText_2->setFont(font); - ui->previewTextEdit->setFont(font); - ui->decoTextEdit->setFont(font); } -void MemoryWidget::on_actionHideDisasm_side_panel_triggered() -{ - if (ui->memSideTabWidget_2->isVisible()) - { - ui->memSideTabWidget_2->hide(); - } - else - { - ui->memSideTabWidget_2->show(); - } -} - -void MemoryWidget::on_actionHideHexdump_side_panel_triggered() +void HexdumpWidget::on_actionHideHexdump_side_panel_triggered() { if (ui->hexSideTab_2->isVisible()) { @@ -782,35 +602,8 @@ void MemoryWidget::on_actionHideHexdump_side_panel_triggered() } } -void MemoryWidget::on_actionHideGraph_side_panel_triggered() -{ - if (ui->graphTreeWidget_2->isVisible()) - { - ui->graphTreeWidget_2->hide(); - } - else - { - ui->graphTreeWidget_2->show(); - } -} -/* - * Buttons callback functions - */ - -void MemoryWidget::on_disasButton_clicked() -{ - ui->memTabWidget->setCurrentIndex(0); - ui->memSideTabWidget_2->setCurrentIndex(0); -} - -void MemoryWidget::on_hexButton_clicked() -{ - ui->memTabWidget->setCurrentIndex(1); - ui->memSideTabWidget_2->setCurrentIndex(1); -} - -/*void MemoryWidget::on_actionSend_to_Notepad_triggered() +/*void HexdumpWidget::on_actionSend_to_Notepad_triggered() { QTextCursor cursor = ui->disasTextEdit_2->textCursor(); QString text = cursor.selectedText(); @@ -818,89 +611,49 @@ void MemoryWidget::on_hexButton_clicked() // this->main->sendToNotepad(text); }*/ -void MemoryWidget::on_action8columns_triggered() +void HexdumpWidget::on_action8columns_triggered() { this->core->setConfig("hex.cols", 8); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_action16columns_triggered() +void HexdumpWidget::on_action16columns_triggered() { this->core->setConfig("hex.cols", 16); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_action4columns_triggered() +void HexdumpWidget::on_action4columns_triggered() { this->core->setConfig("hex.cols", 4); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_action32columns_triggered() +void HexdumpWidget::on_action32columns_triggered() { this->core->setConfig("hex.cols", 32); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_action64columns_triggered() +void HexdumpWidget::on_action64columns_triggered() { this->core->setConfig("hex.cols", 64); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_action2columns_triggered() +void HexdumpWidget::on_action2columns_triggered() { this->core->setConfig("hex.cols", 2); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_action1column_triggered() +void HexdumpWidget::on_action1column_triggered() { this->core->setConfig("hex.cols", 1); - this->refreshHexdump(); + this->refresh(); } -void MemoryWidget::on_xreFromTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/) -{ - XrefDescription xref = item->data(0, Qt::UserRole).value(); - this->core->seek(xref.to); -} - -void MemoryWidget::on_xrefToTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/) -{ - XrefDescription xref = item->data(0, Qt::UserRole).value(); - this->core->seek(xref.from); -} - -void MemoryWidget::on_xrefFromToolButton_2_clicked() -{ - if (ui->xrefFromToolButton_2->isChecked()) - { - ui->xreFromTreeWidget_2->hide(); - ui->xrefFromToolButton_2->setArrowType(Qt::RightArrow); - } - else - { - ui->xreFromTreeWidget_2->show(); - ui->xrefFromToolButton_2->setArrowType(Qt::DownArrow); - } -} - -void MemoryWidget::on_xrefToToolButton_2_clicked() -{ - if (ui->xrefToToolButton_2->isChecked()) - { - ui->xrefToTreeWidget_2->hide(); - ui->xrefToToolButton_2->setArrowType(Qt::RightArrow); - } - else - { - ui->xrefToTreeWidget_2->show(); - ui->xrefToToolButton_2->setArrowType(Qt::DownArrow); - } -} - -void MemoryWidget::on_codeCombo_2_currentTextChanged(const QString &arg1) +void HexdumpWidget::on_codeCombo_2_currentTextChanged(const QString &arg1) { if (arg1 == "Dissasembly") { @@ -914,132 +667,7 @@ void MemoryWidget::on_codeCombo_2_currentTextChanged(const QString &arg1) } } -void MemoryWidget::get_refs_data(RVA addr) -{ - // refs = calls q hace esa funcion - QList refs = core->getXRefs(addr, false, false); - - // xrefs = calls a esa funcion - QList xrefs = core->getXRefs(addr, true, false); - - // Data for the disasm side graph - QList data; - //qDebug() << "Refs:" << refs.size(); - data << refs.size(); - //qDebug() << "XRefs:" << xrefs.size(); - data << xrefs.size(); - //qDebug() << "CC: " << this->core->fcnCyclomaticComplexity(offset.toLong(&ok, 16)); - //data << this->core->fcnCyclomaticComplexity(offset.toLong(&ok, 16)); - data << this->core->getCycloComplex(addr); - //qDebug() << "BB: " << this->core->fcnBasicBlockCount(offset.toLong(&ok, 16)); - data << this->core->fcnBasicBlockCount(addr); - data << this->core->fcnEndBbs(addr); - //qDebug() << "MEOW: " + this->core->fcnEndBbs(offset); - - // Update disasm side bar - this->fill_refs(refs, xrefs, data); -} - -void MemoryWidget::fill_refs(QList refs, QList xrefs, QList graph_data) -{ - this->xreFromTreeWidget_2->clear(); - for (int i = 0; i < refs.size(); ++i) - { - XrefDescription xref = refs[i]; - QTreeWidgetItem *tempItem = new QTreeWidgetItem(); - tempItem->setText(0, RAddressString(xref.to)); - tempItem->setText(1, core->disassembleSingleInstruction(xref.from)); - tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); - QString tooltip = this->core->cmd("pdi 10 @ " + QString::number(xref.to)).trimmed(); - tempItem->setToolTip(0, tooltip); - tempItem->setToolTip(1, tooltip); - this->xreFromTreeWidget_2->insertTopLevelItem(0, tempItem); - } - // Adjust columns to content - int count = this->xreFromTreeWidget_2->columnCount(); - for (int i = 0; i != count; ++i) - { - this->xreFromTreeWidget_2->resizeColumnToContents(i); - } - - this->xrefToTreeWidget_2->clear(); - for (int i = 0; i < xrefs.size(); ++i) - { - XrefDescription xref = xrefs[i]; - - QTreeWidgetItem *tempItem = new QTreeWidgetItem(); - tempItem->setText(0, RAddressString(xref.from)); - tempItem->setText(1, core->disassembleSingleInstruction(xref.from)); - tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); - QString tooltip = this->core->cmd("pdi 10 @ " + QString::number(xref.from)).trimmed(); - tempItem->setToolTip(0, this->core->cmd("pdi 10 @ " + tooltip).trimmed()); - tempItem->setToolTip(1, this->core->cmd("pdi 10 @ " + tooltip).trimmed()); - this->xrefToTreeWidget_2->insertTopLevelItem(0, tempItem); - } - // Adjust columns to content - int count2 = this->xrefToTreeWidget_2->columnCount(); - for (int i = 0; i != count2; ++i) - { - this->xrefToTreeWidget_2->resizeColumnToContents(i); - } - - // Add data to HTML Polar functions graph - QFile html(":/html/fcn_graph.html"); - if (!html.open(QIODevice::ReadOnly)) - { - QMessageBox::information(this, "error", html.errorString()); - } - QString code = html.readAll(); - html.close(); - - QString data = QString("\"%1\", \"%2\", \"%3\", \"%4\", \"%5\"").arg(graph_data.at(2)).arg(graph_data.at(0)).arg(graph_data.at(3)).arg(graph_data.at(1)).arg(graph_data.at(4)); - code.replace("MEOW", data); - ui->fcnWebView->setHtml(code); - - // Add data to HTML Radar functions graph - QFile html2(":/html/fcn_radar.html"); - if (!html2.open(QIODevice::ReadOnly)) - { - QMessageBox::information(this, "error", html.errorString()); - } - QString code2 = html2.readAll(); - html2.close(); - - QString data2 = QString("%1, %2, %3, %4, %5").arg(graph_data.at(2)).arg(graph_data.at(0)).arg(graph_data.at(3)).arg(graph_data.at(1)).arg(graph_data.at(4)); - code2.replace("MEOW", data2); - ui->radarGraphWebView->setHtml(code2); -} - -void MemoryWidget::fillOffsetInfo(QString off) -{ - ui->offsetTreeWidget->clear(); - QString raw = this->core->getOffsetInfo(off); - QList lines = raw.split("\n", QString::SkipEmptyParts); - foreach (QString line, lines) - { - QList eles = line.split(":", QString::SkipEmptyParts); - QTreeWidgetItem *tempItem = new QTreeWidgetItem(); - tempItem->setText(0, eles.at(0).toUpper()); - tempItem->setText(1, eles.at(1)); - ui->offsetTreeWidget->insertTopLevelItem(0, tempItem); - } - - // Adjust column to contents - int count = ui->offsetTreeWidget->columnCount(); - for (int i = 0; i != count; ++i) - { - ui->offsetTreeWidget->resizeColumnToContents(i); - } - - // Add opcode description - QStringList description = this->core->cmd("?d. @ " + off).split(": "); - if (description.length() >= 2) - { - ui->opcodeDescText->setPlainText("# " + description[0] + ":\n" + description[1]); - } -} - -QString MemoryWidget::normalize_addr(QString addr) +QString HexdumpWidget::normalize_addr(QString addr) { QString base = this->core->cmd("s").split("0x")[1].trimmed(); int len = base.length(); @@ -1057,26 +685,7 @@ QString MemoryWidget::normalize_addr(QString addr) } } -void MemoryWidget::setFcnName(RVA addr) -{ - RAnalFunction *fcn; - QString addr_string; - - fcn = this->core->functionAt(addr); - if (fcn) - { - QString segment = this->core->cmd("S. @ " + QString::number(addr)).split(" ").last(); - addr_string = segment.trimmed() + ":" + fcn->name; - } - else - { - addr_string = core->cmdFunctionAt(addr); - } - - ui->fcnNameEdit->setText(addr_string); -} - -QString MemoryWidget::normalizeAddr(QString addr) +QString HexdumpWidget::normalizeAddr(QString addr) { QString base = addr.split("0x")[1].trimmed(); int len = base.length(); @@ -1094,38 +703,7 @@ QString MemoryWidget::normalizeAddr(QString addr) } } -void MemoryWidget::setMiniGraph(QString at) -{ - QString dot = this->core->getSimpleGraph(at); - //QString dot = this->core->cmd("agc " + at); - // Add data to HTML Polar functions graph - QFile html(":/html/graph.html"); - if (!html.open(QIODevice::ReadOnly)) - { - QMessageBox::information(this, "error", html.errorString()); - } - QString code = html.readAll(); - html.close(); - - code.replace("MEOW", dot); - ui->webSimpleGraph->setHtml(code); - -} - -void MemoryWidget::on_polarToolButton_clicked() -{ - ui->radarToolButton->setChecked(false); - ui->fcnGraphTabWidget->setCurrentIndex(0); -} - -void MemoryWidget::on_radarToolButton_clicked() -{ - ui->polarToolButton->setChecked(false); - ui->fcnGraphTabWidget->setCurrentIndex(1); -} - - -void MemoryWidget::on_hexSideTab_2_currentChanged(int /*index*/) +void HexdumpWidget::on_hexSideTab_2_currentChanged(int /*index*/) { /* if (index == 2) { @@ -1144,50 +722,21 @@ void MemoryWidget::on_hexSideTab_2_currentChanged(int /*index*/) */ } -void MemoryWidget::on_memSideToolButton_clicked() +void HexdumpWidget::on_memSideToolButton_clicked() { if (ui->memSideToolButton->isChecked()) { - ui->memSideTabWidget_2->hide(); ui->hexSideTab_2->hide(); ui->memSideToolButton->setIcon(QIcon(":/img/icons/left_light.svg")); } else { - ui->memSideTabWidget_2->show(); ui->hexSideTab_2->show(); ui->memSideToolButton->setIcon(QIcon(":/img/icons/right_light.svg")); } } -void MemoryWidget::on_previewToolButton_clicked() -{ - ui->memPreviewTab->setCurrentIndex(0); -} - -void MemoryWidget::on_decoToolButton_clicked() -{ - ui->memPreviewTab->setCurrentIndex(1); -} - -void MemoryWidget::on_simpleGrapgToolButton_clicked() -{ - ui->memPreviewTab->setCurrentIndex(2); -} - -void MemoryWidget::on_previewToolButton_2_clicked() -{ - if (ui->previewToolButton_2->isChecked()) - { - ui->frame_3->setVisible(true); - } - else - { - ui->frame_3->setVisible(false); - } -} - -void MemoryWidget::resizeEvent(QResizeEvent *event) +void HexdumpWidget::resizeEvent(QResizeEvent *event) { // FIXME /* @@ -1222,13 +771,7 @@ void MemoryWidget::resizeEvent(QResizeEvent *event) QDockWidget::resizeEvent(event); } -void MemoryWidget::setScrollMode() -{ - qhelpers::setVerticalScrollMode(ui->xreFromTreeWidget_2); - qhelpers::setVerticalScrollMode(ui->xrefToTreeWidget_2); -} - -void MemoryWidget::on_copyMD5_clicked() +void HexdumpWidget::on_copyMD5_clicked() { QString md5 = ui->bytesMD5->text(); QClipboard *clipboard = QApplication::clipboard(); @@ -1237,7 +780,7 @@ void MemoryWidget::on_copyMD5_clicked() // this->main->addOutput("MD5 copied to clipboard: " + md5); } -void MemoryWidget::on_copySHA1_clicked() +void HexdumpWidget::on_copySHA1_clicked() { QString sha1 = ui->bytesSHA1->text(); QClipboard *clipboard = QApplication::clipboard(); @@ -1246,19 +789,7 @@ void MemoryWidget::on_copySHA1_clicked() // this->main->addOutput("SHA1 copied to clipboard: " + sha1); } -void MemoryWidget::switchTheme(bool dark) -{ - if (dark) - { - ui->webSimpleGraph->page()->setBackgroundColor(QColor(64, 64, 64)); - } - else - { - ui->webSimpleGraph->page()->setBackgroundColor(QColor(255, 255, 255)); - } -} - -void MemoryWidget::selectHexPreview() +void HexdumpWidget::selectHexPreview() { // Pre-select arch and bits in the hexdump sidebar QString arch = this->core->cmd("e asm.arch").trimmed(); @@ -1277,51 +808,7 @@ void MemoryWidget::selectHexPreview() } } -void MemoryWidget::seek_back() -{ - //this->main->add_debug_output("Back!"); - // FIXME - // this->main->backButton_clicked(); -} - -void MemoryWidget::on_memTabWidget_currentChanged(int /*index*/) -{ - /*this->main->add_debug_output("Update index: " + QString::number(index) + " to function: " + RAddressString(main->getCursorAddress())); - this->main->add_debug_output("Last disasm: " + RAddressString(this->last_disasm_fcn)); - this->main->add_debug_output("Last graph: " + RAddressString(this->last_graph_fcn)); - this->main->add_debug_output("Last hexdump: " + RAddressString(this->last_hexdump_fcn));*/ - this->updateViews(RVA_INVALID); -} - -void MemoryWidget::updateViews(RVA offset) -{ - // Update only the selected view to improve performance - - int index = ui->memTabWidget->tabBar()->currentIndex(); - - // Anyway updateViews will die after break this widget. - // FIXME? One cursor per widget ? (if not synced) - // RVA cursor_addr = main->getCursorAddress(); - // QString cursor_addr_string = RAddressString(cursor_addr); - QString cursor_addr_string = core->cmd("s"); - RVA cursor_addr = cursor_addr_string.toULongLong(); - - if (offset != RVA_INVALID) - next_disasm_top_offset = offset; - - if (index == 1) - { - // Hex - if (this->last_hexdump_fcn != cursor_addr) - { - this->refreshHexdump(cursor_addr_string); - this->last_hexdump_fcn = cursor_addr; - } - } - // TODO WTF -} - -void MemoryWidget::showOffsets(bool show) +void HexdumpWidget::showOffsets(bool show) { if (show) { diff --git a/src/widgets/HexdumpWidget.h b/src/widgets/HexdumpWidget.h new file mode 100644 index 00000000..9ecaceea --- /dev/null +++ b/src/widgets/HexdumpWidget.h @@ -0,0 +1,106 @@ + +#ifndef HEXDUMPWIDGET_H +#define HEXDUMPWIDGET_H + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cutter.h" +#include "utils/Highlighter.h" +#include "utils/HexAsciiHighlighter.h" +#include "utils/HexHighlighter.h" +#include "Dashboard.h" + + +namespace Ui +{ + class HexdumpWidget; +} + +class HexdumpWidget : public QDockWidget +{ +Q_OBJECT + +public: + explicit HexdumpWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0); + explicit HexdumpWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0); + ~HexdumpWidget(); + + QTextEdit *hexOffsetText; + QTextEdit *hexASCIIText; + QTextEdit *hexHexText; + + QPlainTextEdit *hexDisasTextEdit; + + Highlighter *highlighter; + +signals: + void fontChanged(QFont font); + +public slots: + void fillPlugins(); + + QString normalize_addr(QString addr); + + QString normalizeAddr(QString addr); + + void selectHexPreview(); + + void showOffsets(bool show); + +protected: + void resizeEvent(QResizeEvent *event) override; + +private: + std::unique_ptr ui; + CutterCore *core; + + ut64 hexdumpBottomOffset; + + void refresh(RVA addr = RVA_INVALID); + +private slots: + void on_seekChanged(RVA addr); + + void highlightHexCurrentLine(); + void setFonts(QFont font); + + void highlightHexWords(const QString &str); + void on_actionSettings_menu_1_triggered(); + void on_actionHideHexdump_side_panel_triggered(); + + void showHexdumpContextMenu(const QPoint &pt); + void showHexASCIIContextMenu(const QPoint &pt); + + void on_hexHexText_2_selectionChanged(); + void on_hexArchComboBox_2_currentTextChanged(const QString &arg1); + void on_hexBitsComboBox_2_currentTextChanged(const QString &arg1); + + void on_action1column_triggered(); + void on_action2columns_triggered(); + void on_action4columns_triggered(); + void on_action8columns_triggered(); + void on_action16columns_triggered(); + void on_action32columns_triggered(); + void on_action64columns_triggered(); + + void resizeHexdump(); + void hexScrolled(); + QList get_hexdump(const QString &offset); + + void on_codeCombo_2_currentTextChanged(const QString &arg1); + void on_hexSideTab_2_currentChanged(int index); + void on_memSideToolButton_clicked(); + void on_copyMD5_clicked(); + void on_copySHA1_clicked(); +}; + +#endif // HEXDUMPWIDGET_H diff --git a/src/widgets/HexdumpWidget.ui b/src/widgets/HexdumpWidget.ui new file mode 100644 index 00000000..d673b0e2 --- /dev/null +++ b/src/widgets/HexdumpWidget.ui @@ -0,0 +1,1154 @@ + + + HexdumpWidget + + + + 0 + 0 + 959 + 831 + + + + + 0 + 0 + + + + Hexdump + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + background-color: #333; + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 5 + + + 0 + + + 10 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Show/Hide memory sidebar + + + QToolButton { /* all types of tool button */ + border: 5px solid #333; + border-left: 10px solid #333; + border-right: 10px solid #333; + border-radius: 0px; + background-color: #333; + } + +QToolButton:hover { + border: 5px solid #444; + border-left: 10px solid #444; + border-right: 10px solid #444; + border-radius: 0px; + background-color: #444; + } + +QToolButton:pressed { + border: 5px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; +} + +QToolButton:checkeds { + border: 5px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + + + + + :/img/icons/right_light.svg:/img/icons/right_light.svg + + + true + + + + + + + Qt::Horizontal + + + + + + + Settings + + + QToolButton { /* all types of tool button */ + border: 5px solid #333; + border-left: 10px solid #333; + border-right: 10px solid #333; + border-radius: 0px; + background-color: #333; + } + +QToolButton:hover { + border: 5px solid #444; + border-radius: 0px; + background-color: #444; + } + +QToolButton:pressed { + border: 5px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + + + + + :/img/icons/cog_light.svg:/img/icons/cog_light.svg + + + QToolButton::InstantPopup + + + true + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + Anonymous Pro + 13 + + + + false + + + + + + QFrame::NoFrame + + + 0 + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + + + + true + + + QTextEdit::NoWrap + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Anonymous Pro'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monaco'; font-size:12pt;"><br /></p></body></html> + + + false + + + false + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + Anonymous Pro + 13 + + + + false + + + QFrame::NoFrame + + + 0 + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + QTextEdit::NoWrap + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Anonymous Pro'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monaco'; font-size:12pt;"><br /></p></body></html> + + + false + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + Anonymous Pro + 13 + + + + false + + + QFrame::NoFrame + + + 0 + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + QTextEdit::NoWrap + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Anonymous Pro'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monaco'; font-size:12pt;"><br /></p></body></html> + + + false + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + 0 + 0 + + + + QTabWidget::North + + + 0 + + + true + + + false + + + + Parsing + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 5 + + + 0 + + + + + 0 + + + + + + 0 + 0 + + + + + Dissasembly + + + + + String + + + + + Assembler + + + + + C byte array + + + + + C dword array + + + + + C qword array + + + + + Python + + + + + JSON + + + + + Javascript + + + + + + + + + 0 + 0 + + + + Endian + + + + + + + QComboBox::AdjustToMinimumContentsLength + + + + Little + + + + + Big + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + QLayout::SetMinimumSize + + + 5 + + + 0 + + + 5 + + + 5 + + + + + + 0 + 0 + + + + Arch + + + + + + + + 0 + 0 + + + + QComboBox::AdjustToMinimumContentsLength + + + false + + + + + + + + 0 + 0 + + + + Bits + + + + + + + QComboBox::AdjustToMinimumContentsLength + + + + 16 + + + + + 32 + + + + + 64 + + + + + + + + + + + + 0 + 0 + + + + + Anonymous Pro + 13 + + + + QFrame::NoFrame + + + 0 + + + ;; Select some bytes on the left +;; to see them disassembled + + + + + + + + + + Information + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 75 + true + + + + Bytes info + + + + + + + QFormLayout::ExpandingFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + Qt::AlignHCenter|Qt::AlignTop + + + 5 + + + 6 + + + 5 + + + 5 + + + + + + 0 + 0 + + + + MD5: + + + + + + + SHA1: + + + + + + + Entropy: + + + + + + + + 0 + 0 + + + + false + + + true + + + + + + + 5 + + + + + + 0 + 0 + + + + false + + + true + + + + + + + Copy MD5 + + + QToolButton { /* all types of tool button */ + border: 0px solid rgb(255, 255, 255); + border-radius: 6px; + border-left: 5px solid rgb(255, 255, 255); + border-right: 5px solid rgb(255, 255, 255); + margin-bottom: 1px; + margin-top: 1px; + background-color: rgb(255, 255, 255); + image: url(:/img/icons/transfer.svg); +} + +QToolButton:hover { + + border: 0px solid #2180a9; + border-radius: 6px; + border-left: 5px solid #2180a9; + border-right: 5px solid #2180a9; + margin-bottom: 1px; + margin-top: 1px; + background-color: #2180a9; + image: url(:/img/icons/transfer_white.svg); +} + +QToolButton:pressed { + border: 0px solid rgb(255, 255, 255); + border-radius: 6px; + border-left: 5px solid rgb(255, 255, 255); + border-right: 5px solid rgb(255, 255, 255); + margin-bottom: 1px; + margin-top: 1px; + background-color: rgb(255, 255, 255); + image: url(:/img/icons/transfer.svg); +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + + + + + + + + + + 5 + + + + + + 0 + 0 + + + + false + + + true + + + + + + + Copy SHA1 + + + QToolButton { /* all types of tool button */ + border: 0px solid rgb(255, 255, 255); + border-radius: 6px; + border-left: 5px solid rgb(255, 255, 255); + border-right: 5px solid rgb(255, 255, 255); + margin-bottom: 1px; + margin-top: 1px; + background-color: rgb(255, 255, 255); + image: url(:/img/icons/transfer.svg); +} + +QToolButton:hover { + + border: 0px solid #2180a9; + border-radius: 6px; + border-left: 5px solid #2180a9; + border-right: 5px solid #2180a9; + margin-bottom: 1px; + margin-top: 1px; + background-color: #2180a9; + image: url(:/img/icons/transfer_white.svg); +} + +QToolButton:pressed { + border: 0px solid rgb(255, 255, 255); + border-radius: 6px; + border-left: 5px solid rgb(255, 255, 255); + border-right: 5px solid rgb(255, 255, 255); + margin-bottom: 1px; + margin-top: 1px; + background-color: rgb(255, 255, 255); + image: url(:/img/icons/transfer.svg); +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + 0 + + + + + <b>Histogram</b> + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Change font + + + Change font + + + + + Hexdump side panel + + + Hexdump side panel + + + + + Send to notepad + + + Send to notepad + + + + + Undefine + + + Undefine + + + + + Copy all + + + Copy all + + + + + Copy bytes + + + Copy bytes + + + + + Copy disasm + + + Copy disasm + + + + + Copy Hexpair + + + Copy Hexpair + + + + + Copy ASCII + + + Copy ASCII + + + + + Copy Text + + + Copy Text + + + + + 1 + + + 1 + + + + + 2 + + + 2 + + + + + 4 + + + 4 + + + + + 8 + + + 8 + + + + + 16 + + + 16 + + + + + 32 + + + 32 + + + + + 64 + + + 64 + + + + + Edit + + + Edit + + + + + Paste + + + Paste + + + + + Insert Hex + + + Insert Hex + + + + + Insert String + + + Insert String + + + + + + + + + + + + diff --git a/src/widgets/MemoryWidget.h b/src/widgets/MemoryWidget.h deleted file mode 100644 index 8a6153aa..00000000 --- a/src/widgets/MemoryWidget.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef MEMORYWIDGET_H -#define MEMORYWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cutter.h" -#include "utils/Highlighter.h" -#include "utils/HexAsciiHighlighter.h" -#include "utils/HexHighlighter.h" -#include "Dashboard.h" - - -namespace Ui -{ - class MemoryWidget; -} - -class MemoryWidget : public DockWidget -{ - Q_OBJECT - -public: - explicit MemoryWidget(); - ~MemoryWidget(); - - void setup() override; - - void refresh() override; - - QTextEdit *hexOffsetText; - QPlainTextEdit *hexDisasTextEdit; - QTextEdit *hexASCIIText; - QTextEdit *hexHexText; - QTreeWidget *xrefToTreeWidget_2; - QTreeWidget *xreFromTreeWidget_2; - QTabWidget *memTabWidget; - QWebEngineView *histoWebView; - - Highlighter *highlighter; - Highlighter *highlighter_5; - AsciiHighlighter *ascii_highlighter; - HexHighlighter *hex_highlighter; - Highlighter *preview_highlighter; - Highlighter *deco_highlighter; - -signals: - void fontChanged(QFont font); - -public slots: - void fillPlugins(); - - void refreshHexdump(const QString &where = QString()); - - void fill_refs(QList refs, QList xrefs, QList graph_data); - - void fillOffsetInfo(QString off); - - QString normalize_addr(QString addr); - - QString normalizeAddr(QString addr); - - void setMiniGraph(QString at); - - void switchTheme(bool dark); - - void selectHexPreview(); - - void showOffsets(bool show); - -protected: - void resizeEvent(QResizeEvent *event) override; - -private: - std::unique_ptr ui; - CutterCore *core; - - ut64 hexdumpTopOffset; - ut64 hexdumpBottomOffset; - QString last_fcn; - - RVA disasm_top_offset; - RVA next_disasm_top_offset; - - RVA last_graph_fcn; - RVA last_hexdump_fcn; - - void setFcnName(RVA addr); - void get_refs_data(RVA addr); - - void setScrollMode(); - - bool loadMoreDisassembly(); - -private slots: - void on_cursorAddressChanged(RVA addr); - void on_seekChanged(RVA addr); - - void highlightHexCurrentLine(); - void highlightPreviewCurrentLine(); - void highlightDecoCurrentLine(); - void setFonts(QFont font); - - void highlightHexWords(const QString &str); - void on_showInfoButton_2_clicked(); - void on_actionSettings_menu_1_triggered(); - void on_actionHideDisasm_side_panel_triggered(); - void on_actionHideHexdump_side_panel_triggered(); - void on_actionHideGraph_side_panel_triggered(); - - void on_disasButton_clicked(); - void on_hexButton_clicked(); - void showHexdumpContextMenu(const QPoint &pt); - void showHexASCIIContextMenu(const QPoint &pt); - - void on_hexHexText_2_selectionChanged(); - void on_hexArchComboBox_2_currentTextChanged(const QString &arg1); - void on_hexBitsComboBox_2_currentTextChanged(const QString &arg1); - - void on_action1column_triggered(); - void on_action2columns_triggered(); - void on_action4columns_triggered(); - void on_action8columns_triggered(); - void on_action16columns_triggered(); - void on_action32columns_triggered(); - void on_action64columns_triggered(); - - void resizeHexdump(); - void hexScrolled(); - QList get_hexdump(const QString &offset); - - void updateViews(RVA offset = RVA_INVALID); - void cycleViews(); - void on_xreFromTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int column); - void on_xrefToTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int column); - void on_xrefFromToolButton_2_clicked(); - void on_xrefToToolButton_2_clicked(); - void on_codeCombo_2_currentTextChanged(const QString &arg1); - void on_offsetToolButton_clicked(); - void on_polarToolButton_clicked(); - void on_radarToolButton_clicked(); - void on_hexSideTab_2_currentChanged(int index); - void on_memSideToolButton_clicked(); - void on_previewToolButton_clicked(); - void on_decoToolButton_clicked(); - void on_previewToolButton_2_clicked(); - void on_copyMD5_clicked(); - void on_copySHA1_clicked(); - void on_simpleGrapgToolButton_clicked(); - void seek_back(); - void on_memTabWidget_currentChanged(int index); -}; - -#endif // MEMORYWIDGET_H diff --git a/src/widgets/MemoryWidget.ui b/src/widgets/MemoryWidget.ui deleted file mode 100644 index 7a78c4cd..00000000 --- a/src/widgets/MemoryWidget.ui +++ /dev/null @@ -1,2834 +0,0 @@ - - - MemoryWidget - - - - 0 - 0 - 1078 - 815 - - - - - 0 - 0 - - - - Memory - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - background-color: #333; - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - 5 - - - 0 - - - 10 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Disassembly - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:checked { - border: 5px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/disas_light.svg - :/img/icons/disas_white.svg - :/img/icons/disas_white.png:/img/icons/disas_light.svg - - - true - - - true - - - false - - - buttonGroup - - - - - - - - 0 - 0 - - - - Hexdump - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:checked { - border: 5px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/hexdump_light.svg - :/img/icons/hexdump_white.svg - :/img/icons/hexdump_white.svg:/img/icons/hexdump_light.svg - - - true - - - false - - - buttonGroup - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Show/Hide preview panel - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-left: 10px solid #444; - border-right: 10px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:pressed { - border: 5px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checkeds { - border: 5px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/eye.svg - :/img/icons/eye_white.svg - :/img/icons/eye_white.svg:/img/icons/eye.svg - - - true - - - true - - - - - - - Show/Hide memory sidebar - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-left: 10px solid #444; - border-right: 10px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:pressed { - border: 5px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checkeds { - border: 5px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/right_light.svg:/img/icons/right_light.svg - - - true - - - - - - - Qt::Horizontal - - - - - - - Settings - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:pressed { - border: 5px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/cog_light.svg:/img/icons/cog_light.svg - - - QToolButton::InstantPopup - - - true - - - - - - - - - - true - - - QTabWidget::pane { /* The tab widget frame */ -border-top: 0px; -} - - - QTabWidget::South - - - 0 - - - false - - - - Disassembly - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QSplitter::handle { - height: 2px; - background-color: rgb(255, 255, 255); - image: url(:/img/icons/tabs.svg); -} - - - Qt::Horizontal - - - 2 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - background-color: rgb(255, 255, 255); - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 55 - 20 - - - - - - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(255, 255, 255); - border-left: 10px solid rgb(255, 255, 255); - border-right: 10px solid rgb(255, 255, 255); - border-radius: 0px; - background-color: rgb(255, 255, 255); - color: rgb(191, 191, 191); - } - -QToolButton:hover { - border: 3px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; - color: rgb(255, 255, 255); - } - -QToolButton:checked { - border: 3px solid #999; - border-left: 10px solid #999; - border-right: 10px solid #999; - border-radius: 0px; - background-color: #999; - color: rgb(255, 255, 255); -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - Preview - - - true - - - false - - - buttonGroup_3 - - - - - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(255, 255, 255); - border-left: 10px solid rgb(255, 255, 255); - border-right: 10px solid rgb(255, 255, 255); - border-radius: 0px; - background-color: rgb(255, 255, 255); - color: rgb(191, 191, 191); - } - -QToolButton:hover { - border: 3px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; - color: rgb(255, 255, 255); - } - -QToolButton:checked { - border: 3px solid #999; - border-left: 10px solid #999; - border-right: 10px solid #999; - border-radius: 0px; - background-color: #999; - color: rgb(255, 255, 255); -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - Pseudo - - - true - - - false - - - buttonGroup_3 - - - - - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(255, 255, 255); - border-left: 10px solid rgb(255, 255, 255); - border-right: 10px solid rgb(255, 255, 255); - border-radius: 0px; - background-color: rgb(255, 255, 255); - color: rgb(191, 191, 191); - } - -QToolButton:hover { - border: 3px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; - color: rgb(255, 255, 255); - } - -QToolButton:checked { - border: 3px solid #999; - border-left: 10px solid #999; - border-right: 10px solid #999; - border-radius: 0px; - background-color: #999; - color: rgb(255, 255, 255); -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - Graph - - - true - - - true - - - buttonGroup_3 - - - - - - - Qt::Horizontal - - - - 55 - 20 - - - - - - - - - - - - 0 - 0 - - - - - - - QTabWidget::South - - - 2 - - - - Preview - - - - 0 - - - 0 - - - 0 - - - 5 - - - 0 - - - - - - 0 - 0 - - - - - Anonymous Pro - 13 - - - - QFrame::NoFrame - - - QFrame::Plain - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QTextEdit::NoWrap - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - Decomp - - - - 0 - - - 0 - - - 0 - - - 5 - - - 0 - - - - - - 0 - 0 - - - - - Anonymous Pro - 13 - - - - QFrame::NoFrame - - - QFrame::Plain - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - false - - - QPlainTextEdit::NoWrap - - - - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - Graph - - - - 0 - - - 0 - - - 0 - - - 5 - - - 0 - - - - - - 0 - 0 - - - - - Anonymous Pro - 12 - - - - QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); - font: 11pt "Monaco"; -} - - - - about:blank - - - - - - - - - - - - - - - - - Graph - - - - - - Hexdump - - - - 0 - - - 0 - - - 0 - - - 5 - - - 0 - - - - - 5 - - - 0 - - - - - 0 - - - - - - 0 - 0 - - - - - Anonymous Pro - 13 - - - - false - - - - - - QFrame::NoFrame - - - 0 - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - - - - true - - - QTextEdit::NoWrap - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Anonymous Pro'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monaco'; font-size:12pt;"><br /></p></body></html> - - - false - - - false - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - Anonymous Pro - 13 - - - - false - - - QFrame::NoFrame - - - 0 - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - QTextEdit::NoWrap - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Anonymous Pro'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monaco'; font-size:12pt;"><br /></p></body></html> - - - false - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - Anonymous Pro - 13 - - - - false - - - QFrame::NoFrame - - - 0 - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - QTextEdit::NoWrap - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Anonymous Pro'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monaco'; font-size:12pt;"><br /></p></body></html> - - - false - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - - - - - 0 - 0 - - - - - 257 - 16777215 - - - - QTabWidget::pane { /* The tab widget frame */ -border-top: 0px; -} - - - QTabWidget::South - - - 1 - - - - Disas - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 256 - 868 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 5 - - - 2 - - - 5 - - - - - 5 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 75 - true - - - - Function: - - - - - - - - - - - - - false - - - true - - - - - - - - - 5 - - - 0 - - - 5 - - - - - ... - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 0 - 0 - - - - <html><head/><body><p><span style=" font-weight:600;">Information</span></p></body></html> - - - - - - - 0 - - - - - Radar graph - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-left: 10px solid #444; - border-right: 10px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:checked { - border: 5px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/radar_light.svg - :/img/icons/radar_white.svg - :/img/icons/radar_white.svg:/img/icons/radar_light.svg - - - - 8 - 8 - - - - true - - - true - - - buttonGroup_2 - - - - - - - Polar graph - - - QToolButton { /* all types of tool button */ - border: 5px solid #333; - border-left: 10px solid #333; - border-right: 10px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:hover { - border: 5px solid #444; - border-left: 10px solid #444; - border-right: 10px solid #444; - border-radius: 0px; - background-color: #444; - } - -QToolButton:checked { - border: 5px solid #2180a9; - border-left: 10px solid #2180a9; - border-right: 10px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/polar_light.svg - :/img/icons/polar_white.svg - :/img/icons/polar_white.svg:/img/icons/polar_light.svg - - - - 8 - 8 - - - - true - - - false - - - buttonGroup_2 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 250 - - - - - 250 - 250 - - - - 1 - - - - Tab 1 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 245 - 245 - - - - - 250 - 250 - - - - - qrc:/html/fcn_graph.html - - - - - - - - - Tab 2 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 245 - 245 - - - - - 250 - 250 - - - - - qrc:/html/fcn_radar.html - - - - - - - - - - - - 5 - - - 0 - - - - - - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 75 - true - - - - true - - - Offset info: - - - - - - - - - - 0 - 0 - - - - - 0 - 175 - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - 10 - - - true - - - - Info - - - - - Value - - - - - - - - - - ... - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 75 - true - - - - true - - - Opcode description: - - - - - - - - - - 0 - 0 - - - - background-color: rgb(255, 255, 255); -color: rgb(0, 0, 0); - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - false - - - true - - - - - - - 5 - - - 0 - - - - - ... - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 75 - true - - - - X-Refs to current address: - - - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - QTreeWidget::item -{ - padding-left:10px; - padding-top: 1px; - padding-bottom: 1px; - border-left: 10px; -} - -QTreeWidget::item:hover -{ - background: rgb(242, 246, 248); - color: black; -} - -QTreeWidget::item:selected -{ - background: gray; - color: white; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); - font: 12pt "Monaco"; -} - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::ScrollPerPixel - - - 0 - - - - Address - - - - - Instruction - - - - - - - - 5 - - - 0 - - - 0 - - - - - - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 75 - true - - - - X-Refs from current address: - - - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - QTreeWidget::item -{ - padding-left:10px; - padding-top: 1px; - padding-bottom: 1px; - border-left: 10px; -} - -QTreeWidget::item:hover -{ - background: rgb(242, 246, 248); - color: black; -} - -QTreeWidget::item:selected -{ - background: gray; - color: white; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); - font: 12pt "Monaco"; -} - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::ScrollPerPixel - - - 0 - - - - Address - - - - - Instruction - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - Graph - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - 0 - - - false - - - true - - - - Basic blocks - - - - - fcn.08040000 - - - - 0x08048e10 - - - - - 0x08048e50 - - - - - 0x080583FF - - - - - - - - - - Hex - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QTabWidget::North - - - 1 - - - true - - - false - - - - Parsing - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 5 - - - 0 - - - - - 0 - - - - - - 0 - 0 - - - - - Dissasembly - - - - - String - - - - - Assembler - - - - - C byte array - - - - - C dword array - - - - - C qword array - - - - - Python - - - - - JSON - - - - - Javascript - - - - - - - - - 0 - 0 - - - - Endian - - - - - - - QComboBox::AdjustToMinimumContentsLength - - - - Little - - - - - Big - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - QLayout::SetMinimumSize - - - 5 - - - 0 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - Arch - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToMinimumContentsLength - - - false - - - - - - - - 0 - 0 - - - - Bits - - - - - - - QComboBox::AdjustToMinimumContentsLength - - - - 16 - - - - - 32 - - - - - 64 - - - - - - - - - - - - 0 - 0 - - - - - Anonymous Pro - 13 - - - - QFrame::NoFrame - - - 0 - - - ;; Select some bytes on the left -;; to see them disassembled - - - - - - - - - - Information - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 75 - true - - - - Bytes info - - - - - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - Qt::AlignHCenter|Qt::AlignTop - - - 5 - - - 6 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - MD5: - - - - - - - SHA1: - - - - - - - Entropy: - - - - - - - - 0 - 0 - - - - false - - - true - - - - - - - 5 - - - - - - 0 - 0 - - - - false - - - true - - - - - - - Copy MD5 - - - QToolButton { /* all types of tool button */ - border: 0px solid rgb(255, 255, 255); - border-radius: 6px; - border-left: 5px solid rgb(255, 255, 255); - border-right: 5px solid rgb(255, 255, 255); - margin-bottom: 1px; - margin-top: 1px; - background-color: rgb(255, 255, 255); - image: url(:/img/icons/transfer.svg); -} - -QToolButton:hover { - - border: 0px solid #2180a9; - border-radius: 6px; - border-left: 5px solid #2180a9; - border-right: 5px solid #2180a9; - margin-bottom: 1px; - margin-top: 1px; - background-color: #2180a9; - image: url(:/img/icons/transfer_white.svg); -} - -QToolButton:pressed { - border: 0px solid rgb(255, 255, 255); - border-radius: 6px; - border-left: 5px solid rgb(255, 255, 255); - border-right: 5px solid rgb(255, 255, 255); - margin-bottom: 1px; - margin-top: 1px; - background-color: rgb(255, 255, 255); - image: url(:/img/icons/transfer.svg); -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - - - - - - 5 - - - - - - 0 - 0 - - - - false - - - true - - - - - - - Copy SHA1 - - - QToolButton { /* all types of tool button */ - border: 0px solid rgb(255, 255, 255); - border-radius: 6px; - border-left: 5px solid rgb(255, 255, 255); - border-right: 5px solid rgb(255, 255, 255); - margin-bottom: 1px; - margin-top: 1px; - background-color: rgb(255, 255, 255); - image: url(:/img/icons/transfer.svg); -} - -QToolButton:hover { - - border: 0px solid #2180a9; - border-radius: 6px; - border-left: 5px solid #2180a9; - border-right: 5px solid #2180a9; - margin-bottom: 1px; - margin-top: 1px; - background-color: #2180a9; - image: url(:/img/icons/transfer_white.svg); -} - -QToolButton:pressed { - border: 0px solid rgb(255, 255, 255); - border-radius: 6px; - border-left: 5px solid rgb(255, 255, 255); - border-right: 5px solid rgb(255, 255, 255); - margin-bottom: 1px; - margin-top: 1px; - background-color: rgb(255, 255, 255); - image: url(:/img/icons/transfer.svg); -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); -} - - - - - - - - - - - - - - Qt::Horizontal - - - - - - - 0 - - - - - <b>Histogram</b> - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - Change font - - - Change font - - - - - Disasm side panel - - - Disasm side panel - - - - - Hexdump side panel - - - Hexdump side panel - - - - - Graph side panel - - - Graph side panel - - - - - Send to notepad - - - Send to notepad - - - - - Undefine - - - Undefine - - - - - Copy all - - - Copy all - - - - - Copy bytes - - - Copy bytes - - - - - Copy disasm - - - Copy disasm - - - - - Copy Hexpair - - - Copy Hexpair - - - - - Copy ASCII - - - Copy ASCII - - - - - Copy Text - - - Copy Text - - - - - 1 - - - 1 - - - - - 2 - - - 2 - - - - - 4 - - - 4 - - - - - 8 - - - 8 - - - - - 16 - - - 16 - - - - - 32 - - - 32 - - - - - 64 - - - 64 - - - - - Edit - - - Edit - - - - - Paste - - - Paste - - - - - Insert Hex - - - Insert Hex - - - - - Insert String - - - Insert String - - - - - - QWebEngineView - QWidget -
QtWebEngineWidgets/QWebEngineView
-
-
- - - - - - - - - -
diff --git a/src/widgets/PreviewWidget.cpp b/src/widgets/PreviewWidget.cpp new file mode 100644 index 00000000..b7ed24d5 --- /dev/null +++ b/src/widgets/PreviewWidget.cpp @@ -0,0 +1,175 @@ +#include "PreviewWidget.h" +#include "ui_PreviewWidget.h" +#include "DisassemblerGraphView.h" + +#include "utils/Helpers.h" + +#include +#include +#include +#include + +PreviewWidget::PreviewWidget(QWidget *parent, Qt::WindowFlags flags) : + QDockWidget(parent, flags), + ui(new Ui::PreviewWidget), + core(CutterCore::getInstance()) +{ + ui->setupUi(this); + + // Highlight current line on previews and decompiler + connect(ui->previewTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(highlightPreviewCurrentLine())); + connect(ui->decoTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(highlightDecoCurrentLine())); + + // Hide tabs + QTabBar *preTab = ui->memPreviewTab->tabBar(); + preTab->setVisible(false); + + connect(core, SIGNAL(seekChanged(RVA)), this, SLOT(on_seekChanged(RVA))); +} + +PreviewWidget::PreviewWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) : + PreviewWidget(parent, flags) +{ + setWindowTitle(title); +} + +void PreviewWidget::on_seekChanged(RVA addr) +{ + refresh(addr); +} + +void PreviewWidget::highlightPreviewCurrentLine() +{ + + QList extraSelections; + + if (ui->previewTextEdit->toPlainText() != "") + { + if (ui->previewTextEdit->isReadOnly()) + { + QTextEdit::ExtraSelection selection; + + QColor lineColor = QColor(190, 144, 212); + + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = ui->previewTextEdit->textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + } + } + ui->previewTextEdit->setExtraSelections(extraSelections); +} + +void PreviewWidget::highlightDecoCurrentLine() +{ + + QList extraSelections; + + if (ui->decoTextEdit->toPlainText() != "") + { + if (ui->decoTextEdit->isReadOnly()) + { + QTextEdit::ExtraSelection selection; + + QColor lineColor = QColor(190, 144, 212); + + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = ui->decoTextEdit->textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + } + } + ui->decoTextEdit->setExtraSelections(extraSelections); +} + +PreviewWidget::~PreviewWidget() {} + +void PreviewWidget::refresh(RVA addr) +{ + if (addr == RVA_INVALID) + { + addr = core->getSeekAddr(); + } + + setMiniGraph(RAddressString(addr)); + + // TODO: pseudo, ... +} + +/* + * Actions callback functions + */ + +void PreviewWidget::on_actionSettings_menu_1_triggered() +{ + bool ok = true; + + QFont font = QFont("Monospace", 8); + // TODO Use global configuration + //QFont font = QFontDialog::getFont(&ok, ui->disasTextEdit_2->font(), this); + + if (ok) + { + setFonts(font); + + emit fontChanged(font); + } +} + +void PreviewWidget::setFonts(QFont font) +{ + ui->previewTextEdit->setFont(font); + ui->decoTextEdit->setFont(font); +} + +/* + * Buttons callback functions + */ + + +void PreviewWidget::setMiniGraph(QString at) +{ + QString dot = this->core->getSimpleGraph(at); + //QString dot = this->core->cmd("agc " + at); + // Add data to HTML Polar functions graph + QFile html(":/html/graph.html"); + if (!html.open(QIODevice::ReadOnly)) + { + QMessageBox::information(this, "error", html.errorString()); + } + QString code = html.readAll(); + html.close(); + + code.replace("MEOW", dot); + ui->webSimpleGraph->setHtml(code); + +} + +void PreviewWidget::on_previewToolButton_clicked() +{ + ui->memPreviewTab->setCurrentIndex(0); +} + +void PreviewWidget::on_decoToolButton_clicked() +{ + ui->memPreviewTab->setCurrentIndex(1); +} + +void PreviewWidget::on_simpleGrapgToolButton_clicked() +{ + ui->memPreviewTab->setCurrentIndex(2); +} + +void PreviewWidget::switchTheme(bool dark) +{ + if (dark) + { + ui->webSimpleGraph->page()->setBackgroundColor(QColor(64, 64, 64)); + } + else + { + ui->webSimpleGraph->page()->setBackgroundColor(QColor(255, 255, 255)); + } +} \ No newline at end of file diff --git a/src/widgets/PreviewWidget.h b/src/widgets/PreviewWidget.h new file mode 100644 index 00000000..f09905ab --- /dev/null +++ b/src/widgets/PreviewWidget.h @@ -0,0 +1,64 @@ +#ifndef PREVIEWWIDGET_H +#define PREVIEWWIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cutter.h" +#include "utils/Highlighter.h" +#include "utils/HexAsciiHighlighter.h" +#include "utils/HexHighlighter.h" +#include "Dashboard.h" + + +namespace Ui +{ + class PreviewWidget; +} + +class PreviewWidget : public QDockWidget +{ + Q_OBJECT + +public: + explicit PreviewWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0); + explicit PreviewWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0); + ~PreviewWidget(); + + Highlighter *highlighter; + +signals: + void fontChanged(QFont font); + +public slots: + void setMiniGraph(QString at); + + void switchTheme(bool dark); + +private: + std::unique_ptr ui; + CutterCore *core; + + void refresh(RVA addr = RVA_INVALID); + +private slots: + void on_seekChanged(RVA addr); + + void highlightPreviewCurrentLine(); + void highlightDecoCurrentLine(); + void setFonts(QFont font); + + void on_actionSettings_menu_1_triggered(); + void on_previewToolButton_clicked(); + void on_decoToolButton_clicked(); + void on_simpleGrapgToolButton_clicked(); +}; + +#endif // MEMORYWIDGET_H diff --git a/src/widgets/PreviewWidget.ui b/src/widgets/PreviewWidget.ui new file mode 100644 index 00000000..78eee21d --- /dev/null +++ b/src/widgets/PreviewWidget.ui @@ -0,0 +1,661 @@ + + + PreviewWidget + + + + 0 + 0 + 867 + 730 + + + + + 0 + 0 + + + + Preview + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + background-color: rgb(255, 255, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 55 + 20 + + + + + + + + QToolButton { /* all types of tool button */ + border: 3px solid rgb(255, 255, 255); + border-left: 10px solid rgb(255, 255, 255); + border-right: 10px solid rgb(255, 255, 255); + border-radius: 0px; + background-color: rgb(255, 255, 255); + color: rgb(191, 191, 191); + } + +QToolButton:hover { + border: 3px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; + color: rgb(255, 255, 255); + } + +QToolButton:checked { + border: 3px solid #999; + border-left: 10px solid #999; + border-right: 10px solid #999; + border-radius: 0px; + background-color: #999; + color: rgb(255, 255, 255); +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + Preview + + + true + + + false + + + buttonGroup_3 + + + + + + + QToolButton { /* all types of tool button */ + border: 3px solid rgb(255, 255, 255); + border-left: 10px solid rgb(255, 255, 255); + border-right: 10px solid rgb(255, 255, 255); + border-radius: 0px; + background-color: rgb(255, 255, 255); + color: rgb(191, 191, 191); + } + +QToolButton:hover { + border: 3px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; + color: rgb(255, 255, 255); + } + +QToolButton:checked { + border: 3px solid #999; + border-left: 10px solid #999; + border-right: 10px solid #999; + border-radius: 0px; + background-color: #999; + color: rgb(255, 255, 255); +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + Pseudo + + + true + + + false + + + buttonGroup_3 + + + + + + + QToolButton { /* all types of tool button */ + border: 3px solid rgb(255, 255, 255); + border-left: 10px solid rgb(255, 255, 255); + border-right: 10px solid rgb(255, 255, 255); + border-radius: 0px; + background-color: rgb(255, 255, 255); + color: rgb(191, 191, 191); + } + +QToolButton:hover { + border: 3px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; + color: rgb(255, 255, 255); + } + +QToolButton:checked { + border: 3px solid #999; + border-left: 10px solid #999; + border-right: 10px solid #999; + border-radius: 0px; + background-color: #999; + color: rgb(255, 255, 255); +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + Graph + + + true + + + true + + + buttonGroup_3 + + + + + + + Qt::Horizontal + + + + 55 + 20 + + + + + + + + + + + + 0 + 0 + + + + + + + QTabWidget::South + + + 0 + + + + Preview + + + + 0 + + + 0 + + + 0 + + + 5 + + + 0 + + + + + + 0 + 0 + + + + + Anonymous Pro + 13 + + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QTextEdit::NoWrap + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + Decomp + + + + 0 + + + 0 + + + 0 + + + 5 + + + 0 + + + + + + 0 + 0 + + + + + Anonymous Pro + 13 + + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + QPlainTextEdit::NoWrap + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + Graph + + + + 0 + + + 0 + + + 0 + + + 5 + + + 0 + + + + + + 0 + 0 + + + + + Anonymous Pro + 12 + + + + QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); + font: 11pt "Monaco"; +} + + + + about:blank + + + + + + + + + + + + + + + + Change font + + + Change font + + + + + Disasm side panel + + + Disasm side panel + + + + + Hexdump side panel + + + Hexdump side panel + + + + + Graph side panel + + + Graph side panel + + + + + Send to notepad + + + Send to notepad + + + + + Undefine + + + Undefine + + + + + Copy all + + + Copy all + + + + + Copy bytes + + + Copy bytes + + + + + Copy disasm + + + Copy disasm + + + + + Copy Hexpair + + + Copy Hexpair + + + + + Copy ASCII + + + Copy ASCII + + + + + Copy Text + + + Copy Text + + + + + 1 + + + 1 + + + + + 2 + + + 2 + + + + + 4 + + + 4 + + + + + 8 + + + 8 + + + + + 16 + + + 16 + + + + + 32 + + + 32 + + + + + 64 + + + 64 + + + + + Edit + + + Edit + + + + + Paste + + + Paste + + + + + Insert Hex + + + Insert Hex + + + + + Insert String + + + Insert String + + + + + + QWebEngineView + QWidget +
QtWebEngineWidgets/QWebEngineView
+
+
+ + + + + + + +
diff --git a/src/widgets/SidebarWidget.cpp b/src/widgets/SidebarWidget.cpp new file mode 100644 index 00000000..e17dc3ba --- /dev/null +++ b/src/widgets/SidebarWidget.cpp @@ -0,0 +1,306 @@ +#include "SidebarWidget.h" +#include "ui_SidebarWidget.h" +#include "DisassemblerGraphView.h" + +#include "utils/Helpers.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +SidebarWidget::SidebarWidget(QWidget *parent, Qt::WindowFlags flags) : + QDockWidget(parent, flags), + ui(new Ui::SidebarWidget), + core(CutterCore::getInstance()) +{ + ui->setupUi(this); + this->xrefToTreeWidget_2 = ui->xrefToTreeWidget_2; + this->xreFromTreeWidget_2 = ui->xreFromTreeWidget_2; + + // Add margin to function name line edit + ui->fcnNameEdit->setTextMargins(5, 0, 0, 0); + + // Hide fcn graph notebooks tabs + QTabBar *graph_bar = ui->fcnGraphTabWidget->tabBar(); + graph_bar->setVisible(false); + + connect(core, SIGNAL(seekChanged(RVA)), this, SLOT(on_seekChanged(RVA))); + connect(core, SIGNAL(flagsChanged()), this, SLOT(refresh())); + connect(core, SIGNAL(commentsChanged()), this, SLOT(refresh())); + connect(core, SIGNAL(asmOptionsChanged()), this, SLOT(refresh())); + + setScrollMode(); +} + +SidebarWidget::SidebarWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) + : SidebarWidget(parent, flags) +{ + setWindowTitle(title); +} + + +SidebarWidget::~SidebarWidget() +{ +} + +void SidebarWidget::on_seekChanged(RVA addr) +{ + refresh(addr); +} + +void SidebarWidget::refresh(RVA addr) +{ + if(addr == RVA_INVALID) + addr = core->getSeekAddr(); + + get_refs_data(addr); + setFcnName(addr); + fillOffsetInfo(RAddressString(addr)); +} + +/* + * Context menu functions + */ + +void SidebarWidget::on_showInfoButton_2_clicked() +{ + if (ui->showInfoButton_2->isChecked()) + { + ui->fcnGraphTabWidget->hide(); + ui->showInfoButton_2->setArrowType(Qt::RightArrow); + } + else + { + ui->fcnGraphTabWidget->show(); + ui->showInfoButton_2->setArrowType(Qt::DownArrow); + } +} + +void SidebarWidget::on_offsetToolButton_clicked() +{ + if (ui->offsetToolButton->isChecked()) + { + ui->offsetTreeWidget->hide(); + ui->offsetToolButton->setArrowType(Qt::RightArrow); + } + else + { + ui->offsetTreeWidget->show(); + ui->offsetToolButton->setArrowType(Qt::DownArrow); + } +} + +void SidebarWidget::on_xreFromTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/) +{ + XrefDescription xref = item->data(0, Qt::UserRole).value(); + this->core->seek(xref.to); +} + +void SidebarWidget::on_xrefToTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/) +{ + XrefDescription xref = item->data(0, Qt::UserRole).value(); + this->core->seek(xref.from); +} + +void SidebarWidget::on_xrefFromToolButton_2_clicked() +{ + if (ui->xrefFromToolButton_2->isChecked()) + { + ui->xreFromTreeWidget_2->hide(); + ui->xrefFromToolButton_2->setArrowType(Qt::RightArrow); + } + else + { + ui->xreFromTreeWidget_2->show(); + ui->xrefFromToolButton_2->setArrowType(Qt::DownArrow); + } +} + +void SidebarWidget::on_xrefToToolButton_2_clicked() +{ + if (ui->xrefToToolButton_2->isChecked()) + { + ui->xrefToTreeWidget_2->hide(); + ui->xrefToToolButton_2->setArrowType(Qt::RightArrow); + } + else + { + ui->xrefToTreeWidget_2->show(); + ui->xrefToToolButton_2->setArrowType(Qt::DownArrow); + } +} + +void SidebarWidget::get_refs_data(RVA addr) +{ + // refs = calls q hace esa funcion + QList refs = core->getXRefs(addr, false, false); + + // xrefs = calls a esa funcion + QList xrefs = core->getXRefs(addr, true, false); + + // Data for the disasm side graph + QList data; + //qDebug() << "Refs:" << refs.size(); + data << refs.size(); + //qDebug() << "XRefs:" << xrefs.size(); + data << xrefs.size(); + //qDebug() << "CC: " << this->core->fcnCyclomaticComplexity(offset.toLong(&ok, 16)); + //data << this->core->fcnCyclomaticComplexity(offset.toLong(&ok, 16)); + data << this->core->getCycloComplex(addr); + //qDebug() << "BB: " << this->core->fcnBasicBlockCount(offset.toLong(&ok, 16)); + data << this->core->fcnBasicBlockCount(addr); + data << this->core->fcnEndBbs(addr); + //qDebug() << "MEOW: " + this->core->fcnEndBbs(offset); + + // Update disasm side bar + this->fill_refs(refs, xrefs, data); +} + +void SidebarWidget::fill_refs(QList refs, QList xrefs, QList graph_data) +{ + this->xreFromTreeWidget_2->clear(); + for (int i = 0; i < refs.size(); ++i) + { + XrefDescription xref = refs[i]; + QTreeWidgetItem *tempItem = new QTreeWidgetItem(); + tempItem->setText(0, RAddressString(xref.to)); + tempItem->setText(1, core->disassembleSingleInstruction(xref.from)); + tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); + QString tooltip = this->core->cmd("pdi 10 @ " + QString::number(xref.to)).trimmed(); + tempItem->setToolTip(0, tooltip); + tempItem->setToolTip(1, tooltip); + this->xreFromTreeWidget_2->insertTopLevelItem(0, tempItem); + } + // Adjust columns to content + int count = this->xreFromTreeWidget_2->columnCount(); + for (int i = 0; i != count; ++i) + { + this->xreFromTreeWidget_2->resizeColumnToContents(i); + } + + this->xrefToTreeWidget_2->clear(); + for (int i = 0; i < xrefs.size(); ++i) + { + XrefDescription xref = xrefs[i]; + + QTreeWidgetItem *tempItem = new QTreeWidgetItem(); + tempItem->setText(0, RAddressString(xref.from)); + tempItem->setText(1, core->disassembleSingleInstruction(xref.from)); + tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); + QString tooltip = this->core->cmd("pdi 10 @ " + QString::number(xref.from)).trimmed(); + + // TODO wtf is this? + //tempItem->setToolTip(0, this->core->cmd("pdi 10 @ " + tooltip).trimmed()); + //tempItem->setToolTip(1, this->core->cmd("pdi 10 @ " + tooltip).trimmed()); + + this->xrefToTreeWidget_2->insertTopLevelItem(0, tempItem); + } + // Adjust columns to content + int count2 = this->xrefToTreeWidget_2->columnCount(); + for (int i = 0; i != count2; ++i) + { + this->xrefToTreeWidget_2->resizeColumnToContents(i); + } + + // Add data to HTML Polar functions graph + QFile html(":/html/fcn_graph.html"); + if (!html.open(QIODevice::ReadOnly)) + { + QMessageBox::information(this, "error", html.errorString()); + } + QString code = html.readAll(); + html.close(); + + QString data = QString("\"%1\", \"%2\", \"%3\", \"%4\", \"%5\"").arg(graph_data.at(2)).arg(graph_data.at(0)).arg(graph_data.at(3)).arg(graph_data.at(1)).arg(graph_data.at(4)); + code.replace("MEOW", data); + ui->fcnWebView->setHtml(code); + + // Add data to HTML Radar functions graph + QFile html2(":/html/fcn_radar.html"); + if (!html2.open(QIODevice::ReadOnly)) + { + QMessageBox::information(this, "error", html.errorString()); + } + QString code2 = html2.readAll(); + html2.close(); + + QString data2 = QString("%1, %2, %3, %4, %5").arg(graph_data.at(2)).arg(graph_data.at(0)).arg(graph_data.at(3)).arg(graph_data.at(1)).arg(graph_data.at(4)); + code2.replace("MEOW", data2); + ui->radarGraphWebView->setHtml(code2); +} + +void SidebarWidget::fillOffsetInfo(QString off) +{ + ui->offsetTreeWidget->clear(); + QString raw = this->core->getOffsetInfo(off); + QList lines = raw.split("\n", QString::SkipEmptyParts); + foreach (QString line, lines) + { + QList eles = line.split(":", QString::SkipEmptyParts); + QTreeWidgetItem *tempItem = new QTreeWidgetItem(); + tempItem->setText(0, eles.at(0).toUpper()); + tempItem->setText(1, eles.at(1)); + ui->offsetTreeWidget->insertTopLevelItem(0, tempItem); + } + + // Adjust column to contents + int count = ui->offsetTreeWidget->columnCount(); + for (int i = 0; i != count; ++i) + { + ui->offsetTreeWidget->resizeColumnToContents(i); + } + + // Add opcode description + QStringList description = this->core->cmd("?d. @ " + off).split(": "); + if (description.length() >= 2) + { + ui->opcodeDescText->setPlainText("# " + description[0] + ":\n" + description[1]); + } +} + +void SidebarWidget::setFcnName(RVA addr) +{ + RAnalFunction *fcn; + QString addr_string; + + fcn = this->core->functionAt(addr); + if (fcn) + { + QString segment = this->core->cmd("S. @ " + QString::number(addr)).split(" ").last(); + addr_string = segment.trimmed() + ":" + fcn->name; + } + else + { + addr_string = core->cmdFunctionAt(addr); + } + + ui->fcnNameEdit->setText(addr_string); +} + +void SidebarWidget::on_polarToolButton_clicked() +{ + ui->radarToolButton->setChecked(false); + ui->fcnGraphTabWidget->setCurrentIndex(0); +} + +void SidebarWidget::on_radarToolButton_clicked() +{ + ui->polarToolButton->setChecked(false); + ui->fcnGraphTabWidget->setCurrentIndex(1); +} + +void SidebarWidget::setScrollMode() +{ + qhelpers::setVerticalScrollMode(ui->xreFromTreeWidget_2); + qhelpers::setVerticalScrollMode(ui->xrefToTreeWidget_2); +} \ No newline at end of file diff --git a/src/widgets/SidebarWidget.h b/src/widgets/SidebarWidget.h new file mode 100644 index 00000000..9b839474 --- /dev/null +++ b/src/widgets/SidebarWidget.h @@ -0,0 +1,66 @@ + +#ifndef SIDEBARWIDGET_H +#define SIDEBARWIDGET_H + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cutter.h" +#include "utils/Highlighter.h" +#include "utils/HexAsciiHighlighter.h" +#include "utils/HexHighlighter.h" +#include "Dashboard.h" + + +namespace Ui +{ + class SidebarWidget; +} + +class SidebarWidget : public QDockWidget +{ +Q_OBJECT + +public: + explicit SidebarWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0); + explicit SidebarWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0); + ~SidebarWidget(); + + QTreeWidget *xrefToTreeWidget_2; + QTreeWidget *xreFromTreeWidget_2; + +private: + std::unique_ptr ui; + CutterCore *core; + + void setFcnName(RVA addr); + void get_refs_data(RVA addr); + void fill_refs(QList refs, QList xrefs, QList graph_data); + void fillOffsetInfo(QString off); + + void setScrollMode(); + +private slots: + void on_seekChanged(RVA addr); + + void refresh(RVA addr = RVA_INVALID); + + void on_showInfoButton_2_clicked(); + void on_xreFromTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int column); + void on_xrefToTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int column); + void on_xrefFromToolButton_2_clicked(); + void on_xrefToToolButton_2_clicked(); + void on_offsetToolButton_clicked(); + void on_polarToolButton_clicked(); + void on_radarToolButton_clicked(); +}; + +#endif // SIDEBARWIDGET_H diff --git a/src/widgets/SidebarWidget.ui b/src/widgets/SidebarWidget.ui new file mode 100644 index 00000000..919c6d12 --- /dev/null +++ b/src/widgets/SidebarWidget.ui @@ -0,0 +1,877 @@ + + + SidebarWidget + + + + 0 + 0 + 333 + 835 + + + + + 0 + 0 + + + + Sidebar + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 319 + 882 + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 5 + + + 2 + + + 5 + + + + + 5 + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + 75 + true + + + + Function: + + + + + + + + + + + + + false + + + true + + + + + + + + + 5 + + + 0 + + + 5 + + + + + ... + + + + 8 + 8 + + + + true + + + true + + + Qt::DownArrow + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-weight:600;">Information</span></p></body></html> + + + + + + + 0 + + + + + Radar graph + + + QToolButton { /* all types of tool button */ + border: 5px solid #333; + border-left: 10px solid #333; + border-right: 10px solid #333; + border-radius: 0px; + background-color: #333; + } + +QToolButton:hover { + border: 5px solid #444; + border-left: 10px solid #444; + border-right: 10px solid #444; + border-radius: 0px; + background-color: #444; + } + +QToolButton:checked { + border: 5px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + + + + + :/img/icons/radar_light.svg + :/img/icons/radar_white.svg + :/img/icons/radar_white.svg:/img/icons/radar_light.svg + + + + 8 + 8 + + + + true + + + true + + + buttonGroup_2 + + + + + + + Polar graph + + + QToolButton { /* all types of tool button */ + border: 5px solid #333; + border-left: 10px solid #333; + border-right: 10px solid #333; + border-radius: 0px; + background-color: #333; + } + +QToolButton:hover { + border: 5px solid #444; + border-left: 10px solid #444; + border-right: 10px solid #444; + border-radius: 0px; + background-color: #444; + } + +QToolButton:checked { + border: 5px solid #2180a9; + border-left: 10px solid #2180a9; + border-right: 10px solid #2180a9; + border-radius: 0px; + background-color: #2180a9; +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); +} + + + + + + + :/img/icons/polar_light.svg + :/img/icons/polar_white.svg + :/img/icons/polar_white.svg:/img/icons/polar_light.svg + + + + 8 + 8 + + + + true + + + false + + + buttonGroup_2 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 250 + + + + + 16777215 + 250 + + + + 0 + + + + Tab 1 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 245 + 245 + + + + + 16777215 + 250 + + + + + qrc:/html/fcn_graph.html + + + + + + + + + Tab 2 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 245 + 245 + + + + + 16777215 + 250 + + + + + qrc:/html/fcn_radar.html + + + + + + + + + + + + 5 + + + 0 + + + + + + + + + 8 + 8 + + + + true + + + true + + + Qt::DownArrow + + + + + + + + 75 + true + + + + true + + + Offset info: + + + + + + + + + + 0 + 0 + + + + + 0 + 175 + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + 10 + + + true + + + + Info + + + + + Value + + + + + + + + + + ... + + + + 8 + 8 + + + + true + + + true + + + Qt::DownArrow + + + + + + + + 75 + true + + + + true + + + Opcode description: + + + + + + + + + + 0 + 0 + + + + background-color: rgb(255, 255, 255); +color: rgb(0, 0, 0); + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + true + + + + + + + 5 + + + 0 + + + + + ... + + + + 8 + 8 + + + + true + + + true + + + Qt::DownArrow + + + + + + + + 75 + true + + + + X-Refs to current address: + + + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + QTreeWidget::item +{ + padding-left:10px; + padding-top: 1px; + padding-bottom: 1px; + border-left: 10px; +} + +QTreeWidget::item:hover +{ + background: rgb(242, 246, 248); + color: black; +} + +QTreeWidget::item:selected +{ + background: gray; + color: white; +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); + font: 12pt "Monaco"; +} + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::ScrollPerPixel + + + 0 + + + + Address + + + + + Instruction + + + + + + + + 5 + + + 0 + + + 0 + + + + + + + + + 8 + 8 + + + + true + + + true + + + Qt::DownArrow + + + + + + + + 75 + true + + + + X-Refs from current address: + + + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + QTreeWidget::item +{ + padding-left:10px; + padding-top: 1px; + padding-bottom: 1px; + border-left: 10px; +} + +QTreeWidget::item:hover +{ + background: rgb(242, 246, 248); + color: black; +} + +QTreeWidget::item:selected +{ + background: gray; + color: white; +} + +QToolTip { + background-color: #444; + border: 3px solid #444; + color: rgb(232, 232, 232); + font: 12pt "Monaco"; +} + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::ScrollPerPixel + + + 0 + + + + Address + + + + + Instruction + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + QWebEngineView + QWidget +
QtWebEngineWidgets/QWebEngineView
+
+
+ + + + + + + + + +