From 9a3844f5d1aa11056a69f7105c8937f7d9fa66d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Mon, 24 Dec 2018 16:25:55 +0100 Subject: [PATCH] Kill SidebarWidget --- src/Cutter.pro | 6 - src/MainWindow.cpp | 6 +- src/MainWindow.h | 2 - src/MainWindow.ui | 9 - src/widgets/Sidebar.cpp | 65 -- src/widgets/Sidebar.h | 42 -- src/widgets/Sidebar.ui | 1086 --------------------------------- src/widgets/SidebarWidget.cpp | 241 -------- src/widgets/SidebarWidget.h | 61 -- src/widgets/SidebarWidget.ui | 629 ------------------- 10 files changed, 1 insertion(+), 2146 deletions(-) delete mode 100644 src/widgets/Sidebar.cpp delete mode 100644 src/widgets/Sidebar.h delete mode 100644 src/widgets/Sidebar.ui delete mode 100644 src/widgets/SidebarWidget.cpp delete mode 100644 src/widgets/SidebarWidget.h delete mode 100644 src/widgets/SidebarWidget.ui diff --git a/src/Cutter.pro b/src/Cutter.pro index 210f6d92..78937669 100644 --- a/src/Cutter.pro +++ b/src/Cutter.pro @@ -156,12 +156,10 @@ SOURCES += \ widgets/SdbDock.cpp \ widgets/SectionsWidget.cpp \ widgets/SegmentsWidget.cpp \ - widgets/Sidebar.cpp \ widgets/StringsWidget.cpp \ widgets/SymbolsWidget.cpp \ menus/DisassemblyContextMenu.cpp \ widgets/DisassemblyWidget.cpp \ - widgets/SidebarWidget.cpp \ widgets/HexdumpWidget.cpp \ common/Configuration.cpp \ common/Colors.cpp \ @@ -256,12 +254,10 @@ HEADERS += \ widgets/SdbDock.h \ widgets/SectionsWidget.h \ widgets/SegmentsWidget.h \ - widgets/Sidebar.h \ widgets/StringsWidget.h \ widgets/SymbolsWidget.h \ menus/DisassemblyContextMenu.h \ widgets/DisassemblyWidget.h \ - widgets/SidebarWidget.h \ widgets/HexdumpWidget.h \ common/Configuration.h \ common/Colors.h \ @@ -348,10 +344,8 @@ FORMS += \ widgets/ImportsWidget.ui \ widgets/SdbDock.ui \ widgets/RelocsWidget.ui \ - widgets/Sidebar.ui \ widgets/StringsWidget.ui \ widgets/SymbolsWidget.ui \ - widgets/SidebarWidget.ui \ widgets/HexdumpWidget.ui \ dialogs/SaveProjectDialog.ui \ dialogs/preferences/PreferencesDialog.ui \ diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 37b1c1e6..353b32ca 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -68,7 +68,6 @@ #include "widgets/FlagsWidget.h" #include "widgets/VisualNavbar.h" #include "widgets/Dashboard.h" -#include "widgets/Sidebar.h" #include "widgets/SdbDock.h" #include "widgets/Omnibar.h" #include "widgets/ConsoleWidget.h" @@ -177,7 +176,6 @@ void MainWindow::initUI() dockWidgets.reserve(20); disassemblyDock = new DisassemblyWidget(this, ui->actionDisassembly); - sidebarDock = new SidebarWidget(this, ui->actionSidebar); hexdumpDock = new HexdumpWidget(this, ui->actionHexdump); pseudocodeDock = new PseudocodeWidget(this, ui->actionPseudocode); consoleDock = new ConsoleWidget(this, ui->actionConsole); @@ -551,9 +549,8 @@ void MainWindow::restoreDocks() // In the upper half the functions are the first widget addDockWidget(Qt::TopDockWidgetArea, functionsDock); - // Function | Dashboard | Sidebar + // Function | Dashboard splitDockWidget(functionsDock, dashboardDock, Qt::Horizontal); - splitDockWidget(dashboardDock, sidebarDock, Qt::Horizontal); // In the lower half the console is the first widget addDockWidget(Qt::BottomDockWidgetArea, consoleDock); @@ -585,7 +582,6 @@ void MainWindow::restoreDocks() tabifyDockWidget(dashboardDock, vTablesDock); // Add Stack, Registers and Backtrace vertically stacked - splitDockWidget(sidebarDock, stackDock, Qt::Horizontal); splitDockWidget(stackDock, registersDock, Qt::Vertical); tabifyDockWidget(stackDock, backtraceDock); // MemoryMap/Breakpoint/RegRefs widget goes in the center tabs diff --git a/src/MainWindow.h b/src/MainWindow.h index fc60634e..a754cc57 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -5,7 +5,6 @@ #include "Cutter.h" // only needed for ut64 #include "widgets/DisassemblyWidget.h" -#include "widgets/SidebarWidget.h" #include "widgets/StackWidget.h" #include "widgets/RegistersWidget.h" #include "widgets/BacktraceWidget.h" @@ -196,7 +195,6 @@ private: QList dockWidgets; QMap dockWidgetActions; DisassemblyWidget *disassemblyDock = nullptr; - SidebarWidget *sidebarDock = nullptr; HexdumpWidget *hexdumpDock = nullptr; PseudocodeWidget *pseudocodeDock = nullptr; QDockWidget *graphDock = nullptr; diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 0b94d66d..2af8acfe 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -197,7 +197,6 @@ QToolTip { - @@ -950,14 +949,6 @@ QToolTip { Hexdump - - - true - - - Sidebar - - true diff --git a/src/widgets/Sidebar.cpp b/src/widgets/Sidebar.cpp deleted file mode 100644 index 615d9779..00000000 --- a/src/widgets/Sidebar.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "Sidebar.h" -#include "ui_Sidebar.h" - -#include "MainWindow.h" - -#include - - -SideBar::SideBar(MainWindow *main) : - QWidget(main), - ui(new Ui::SideBar), - main(main) -{ - ui->setupUi(this); - - QSettings settings; - if (settings.value("responsive").toBool()) { - ui->respButton->setChecked(true); - } else { - ui->respButton->setChecked(false); - } -} - -SideBar::~SideBar() {} - -void SideBar::on_tabsButton_clicked() -{ - this->main->on_actionTabs_triggered(); -} - -void SideBar::on_lockButton_clicked() -{ - if (ui->lockButton->isChecked()) { - ui->lockButton->setIcon(QIcon(":/img/icons/unlock_white.svg")); - this->main->lockUnlock_Docks(1); - } else { - ui->lockButton->setIcon(QIcon(":/img/icons/lock_white.svg")); - this->main->lockUnlock_Docks(0); - } -} - -void SideBar::on_calcInput_textChanged(const QString &arg1) -{ - ui->calcOutput->setText(QString::number(Core()->math(arg1))); -} - -void SideBar::on_asm2hex_clicked() -{ - ui->hexInput->setPlainText(Core()->assemble(ui->asmInput->toPlainText())); -} - -void SideBar::on_hex2asm_clicked() -{ - ui->asmInput->setPlainText(Core()->disassemble(ui->hexInput->toPlainText())); -} - -void SideBar::on_respButton_toggled(bool checked) -{ - this->main->toggleResponsive(checked); -} - -void SideBar::on_refreshButton_clicked() -{ - this->main->refreshAll(); -} diff --git a/src/widgets/Sidebar.h b/src/widgets/Sidebar.h deleted file mode 100644 index 9e1dc078..00000000 --- a/src/widgets/Sidebar.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SIDEBAR_H -#define SIDEBAR_H - -#include -#include - -class MainWindow; - -namespace Ui { -class SideBar; -} - -class SideBar : public QWidget -{ - Q_OBJECT - -public: - explicit SideBar(MainWindow *main); - ~SideBar(); - -private slots: - - void on_tabsButton_clicked(); - - void on_lockButton_clicked(); - - void on_calcInput_textChanged(const QString &arg1); - - void on_asm2hex_clicked(); - - void on_hex2asm_clicked(); - - void on_respButton_toggled(bool checked); - - void on_refreshButton_clicked(); - -private: - std::unique_ptr ui; - MainWindow *main; -}; - -#endif // SIDEBAR_H diff --git a/src/widgets/Sidebar.ui b/src/widgets/Sidebar.ui deleted file mode 100644 index e2e3d04b..00000000 --- a/src/widgets/Sidebar.ui +++ /dev/null @@ -1,1086 +0,0 @@ - - - SideBar - - - - 0 - 0 - 230 - 774 - - - - Form - - - background-color: rgba(255, 255, 255, 0); - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - - - 0 - 0 - 228 - 772 - - - - - 5 - - - 0 - - - 5 - - - 0 - - - 5 - - - - - 0 - - - - - - 0 - 0 - - - - color: rgb(228, 228, 228); -background-color: rgb(48, 48, 48); -border: 3px solid rgb(48, 48, 48); - - - Notifications - - - - - - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 226 - 602 - - - - - 10 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - 5 - - - - - 0 - - - 0 - - - - - - 12 - - - - color: rgb(255, 255, 255); -background-color: rgb(128, 128, 128); -border-color: rgb(128, 128, 128); - - - Script - - - 3 - - - 2 - - - - - - - - 75 - true - - - - QToolButton { /* all types of tool button */ - border: 5px solid rgb(128, 128, 128); - border-left: 5px solid rgb(128, 128, 128); - border-right: 5px solid rgb(128, 128, 128); - background-color: rgb(128, 128, 128); - color: rgb(255, 255, 255) - } - -QToolButton:hover { - border: 5px solid #333; - border-left: 5px solid #333; - border-right: 5px solid #333; - background-color: #333; - } - -QToolButton:pressed { - border: 5px solid #2180a9; - border-left: 5px solid #2180a9; - border-right: 5px solid #2180a9; - background-color: #2180a9; -} - - - X - - - - - - - - - 0 - - - - - 0 - - - - - - 0 - 0 - - - - - 12 - - - - color: rgb(255, 255, 255); - - - example.py - - - 5 - - - - - - - - 0 - 0 - - - - - 12 - - - - color: rgb(191, 191, 191); - - - Execution finished - - - 5 - - - - - - - - - - 0 - 0 - - - - - 30 - 0 - - - - - - - :/img/icons/spin_white.svg - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - 5 - - - - - color: rgb(228, 228, 228); -background-color: rgb(48, 48, 48); -border: 3px solid rgb(48, 48, 48); - - - Calculator - - - - - - - color: rgb(255, 255, 255); -background-color: rgb(128, 128, 128); -border-color: rgb(128, 128, 128); - - - false - - - true - - - - - - - color: rgb(255, 255, 255); -border-color: rgb(128, 128, 128); - - - QFrame::Box - - - 0 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - 5 - - - - - color: rgb(228, 228, 228); -background-color: rgb(48, 48, 48); -border: 3px solid rgb(48, 48, 48); - - - Assembler - - - - - - - color: rgb(255, 255, 255); -background-color: rgb(128, 128, 128); -border-color: rgb(128, 128, 128); - - - Assembly - - - 2 - - - 2 - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - color: rgb(255, 255, 255); -border-color: rgb(128, 128, 128); - - - QFrame::Box - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - 0 - - - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(128, 128, 128); - border-left: 3px solid rgb(128, 128, 128); - border-right: 3px solid rgb(128, 128, 128); - background-color: rgb(128, 128, 128); - color: rgb(255, 255, 255) - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 3px solid #333; - border-right: 3px solid #333; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 3px solid #2180a9; - border-right: 3px solid #2180a9; - background-color: #2180a9; -} - - - v - - - - - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(128, 128, 128); - border-left: 3px solid rgb(128, 128, 128); - border-right: 3px solid rgb(128, 128, 128); - background-color: rgb(128, 128, 128); - color: rgb(255, 255, 255) - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 3px solid #333; - border-right: 3px solid #333; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 3px solid #2180a9; - border-right: 3px solid #2180a9; - background-color: #2180a9; -} - - - - ^ - - - - - - - - - color: rgb(255, 255, 255); -background-color: rgb(128, 128, 128); -border-color: rgb(128, 128, 128); - - - Hexadecimal - - - 2 - - - 2 - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - color: rgb(255, 255, 255); -border-color: rgb(128, 128, 128); - - - QFrame::Box - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - color: rgb(228, 228, 228); -background-color: rgb(48, 48, 48); -border: 3px solid rgb(48, 48, 48); - - - Quick actions - - - - - - - 5 - - - 5 - - - 5 - - - 5 - - - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/up_white.svg:/img/icons/up_white.svg - - - - - - - Tabs Up/Down - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/tabs_white.svg:/img/icons/tabs_white.svg - - - - - - - Show/Hide Console - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/down_white.svg:/img/icons/down_white.svg - - - true - - - - - - - Switch theme - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/themes_white.svg:/img/icons/themes_white.svg - - - true - - - - - - - - - 5 - - - 5 - - - 0 - - - 5 - - - - - Toogle resposiveness - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - ... - - - - :/img/icons/disas_white.svg:/img/icons/disas_white.svg - - - true - - - true - - - - - - - Refresh memory - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - - - - - :/img/icons/spin_white.svg:/img/icons/spin_white.svg - - - - - - - Lock/Unlock interface - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - ... - - - - :/img/icons/unlock_white.svg:/img/icons/unlock_white.svg - - - true - - - - - - - - - 13 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Settings - - - QToolButton { /* all types of tool button */ - border: 5px solid rgb(64, 64, 64); - border-left: 7px solid rgb(64, 64, 64); - border-right: 7px solid rgb(64, 64, 64); - border-radius: 0px; - background-color: rgb(64, 64, 64); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 5px solid #333; - border-left: 7px solid #333; - border-right: 7px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 5px solid #2180a9; - border-left: 7px solid #2180a9; - border-right: 7px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - Settings - - - - :/img/icons/cog_white.svg:/img/icons/cog_white.svg - - - Qt::ToolButtonIconOnly - - - - - - - - - - - - - - - - diff --git a/src/widgets/SidebarWidget.cpp b/src/widgets/SidebarWidget.cpp deleted file mode 100644 index f63163cc..00000000 --- a/src/widgets/SidebarWidget.cpp +++ /dev/null @@ -1,241 +0,0 @@ -#include "SidebarWidget.h" -#include "ui_SidebarWidget.h" -#include "DisassemblerGraphView.h" - -#include "common/Helpers.h" -#include "common/TempConfig.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -SidebarWidget::SidebarWidget(MainWindow *main, QAction *action) : - CutterDockWidget(main, action), - ui(new Ui::SidebarWidget) -{ - ui->setupUi(this); - - // Add margin to function name line edit - ui->fcnNameEdit->setTextMargins(5, 0, 0, 0); - - setScrollMode(); - - 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())); - - connect(Core(), SIGNAL(refreshAll()), this, SLOT(refresh())); -} - -SidebarWidget::~SidebarWidget() -{ -} - -void SidebarWidget::on_seekChanged(RVA addr) -{ - refresh(addr); -} - -void SidebarWidget::refresh(RVA addr) -{ - if (addr == RVA_INVALID) - addr = Core()->getOffset(); - - updateRefs(addr); - setFcnName(addr); - fillOffsetInfo(RAddressString(addr)); - fillRegistersInfo(); -} - -void SidebarWidget::on_xrefFromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) -{ - if (column < 0) - return; - - XrefDescription xref = item->data(0, Qt::UserRole).value(); - Core()->seek(xref.to); -} - -void SidebarWidget::on_xrefToTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) -{ - if (column < 0) - return; - - XrefDescription xref = item->data(0, Qt::UserRole).value(); - Core()->seek(xref.from); -} - -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_opcodeDescToolButton_clicked() -{ - if (ui->opcodeDescToolButton->isChecked()) { - ui->opcodeDescText->hide(); - ui->opcodeDescToolButton->setArrowType(Qt::RightArrow); - } else { - ui->opcodeDescText->show(); - ui->opcodeDescToolButton->setArrowType(Qt::DownArrow); - } -} - -void SidebarWidget::on_xrefFromToolButton_clicked() -{ - if (ui->xrefFromToolButton->isChecked()) { - ui->xrefFromTreeWidget->hide(); - ui->xrefFromToolButton->setArrowType(Qt::RightArrow); - } else { - ui->xrefFromTreeWidget->show(); - ui->xrefFromToolButton->setArrowType(Qt::DownArrow); - } -} - -void SidebarWidget::on_xrefToToolButton_clicked() -{ - if (ui->xrefToToolButton->isChecked()) { - ui->xrefToTreeWidget->hide(); - ui->xrefToToolButton->setArrowType(Qt::RightArrow); - } else { - ui->xrefToTreeWidget->show(); - ui->xrefToToolButton->setArrowType(Qt::DownArrow); - } -} - -void SidebarWidget::on_regInfoToolButton_clicked() -{ - if (ui->regInfoToolButton->isChecked()) { - ui->regInfoTreeWidget->hide(); - ui->regInfoToolButton->setArrowType(Qt::RightArrow); - } else { - ui->regInfoTreeWidget->show(); - ui->regInfoToolButton->setArrowType(Qt::DownArrow); - } -} - -void SidebarWidget::updateRefs(RVA addr) -{ - QList refs = Core()->getXRefs(addr, false, false); - QList xrefs = Core()->getXRefs(addr, true, false); - - // Update disasm side bar - this->fillRefs(refs, xrefs); -} - -void SidebarWidget::fillRefs(QList refs, QList xrefs) -{ - TempConfig tempConfig; - tempConfig.set("scr.html", false) - .set("scr.color", COLOR_MODE_DISABLED); - - ui->xrefFromTreeWidget->clear(); - for (int i = 0; i < refs.size(); ++i) { - XrefDescription xref = refs[i]; - QTreeWidgetItem *tempItem = new QTreeWidgetItem(); - tempItem->setText(0, xref.to_str); - tempItem->setText(1, Core()->disassembleSingleInstruction(xref.to)); - tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); - QString tooltip = Core()->cmd("pdi 10 @ " + QString::number(xref.to)).trimmed(); - tempItem->setToolTip(0, tooltip); - tempItem->setToolTip(1, tooltip); - ui->xrefFromTreeWidget->insertTopLevelItem(0, tempItem); - } - // Adjust columns to content - qhelpers::adjustColumns(ui->xrefFromTreeWidget, 0); - - ui->xrefToTreeWidget->clear(); - for (int i = 0; i < xrefs.size(); ++i) { - XrefDescription xref = xrefs[i]; - - QTreeWidgetItem *tempItem = new QTreeWidgetItem(); - tempItem->setText(0, xref.from_str); - tempItem->setText(1, Core()->disassembleSingleInstruction(xref.from)); - tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); - QString tooltip = Core()->cmd("pdi 10 @ " + QString::number(xref.from)).trimmed(); - - ui->xrefToTreeWidget->insertTopLevelItem(0, tempItem); - } - - // Adjust columns to content - qhelpers::adjustColumns(ui->xrefToTreeWidget, 0); -} - -void SidebarWidget::fillOffsetInfo(QString off) -{ - TempConfig tempConfig; - tempConfig.set("scr.html", false) - .set("scr.color", COLOR_MODE_DISABLED); - - ui->offsetTreeWidget->clear(); - QString raw = Core()->cmd(QString("ao@") + off).trimmed(); - QList lines = raw.split("\n", QString::SkipEmptyParts); - for (const QString &line : lines) { - QList eles = line.split(":", QString::SkipEmptyParts); - if (eles.length() < 2) { - continue; - } - 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 - qhelpers::adjustColumns(ui->offsetTreeWidget, 0); - - // Add opcode description - QStringList description = Core()->cmd("aod @ " + off).split(": "); - if (description.length() >= 2) { - ui->opcodeDescText->setPlainText("# " + description[0] + ":\n" + description[1]); - } -} - -void SidebarWidget::setFcnName(RVA addr) -{ - ui->fcnNameEdit->setText(Core()->cmdFunctionAt(addr)); -} - -void SidebarWidget::setScrollMode() -{ - qhelpers::setVerticalScrollMode(ui->xrefFromTreeWidget); - qhelpers::setVerticalScrollMode(ui->xrefToTreeWidget); -} - -void SidebarWidget::fillRegistersInfo() -{ - TempConfig tempConfig; - tempConfig.set("scr.html", false) - .set("scr.color", COLOR_MODE_DISABLED); - - ui->regInfoTreeWidget->clear(); - - QJsonObject jsonRoot = Core()->getRegistersInfo().object(); - for (const QString &key : jsonRoot.keys()) { - QTreeWidgetItem *tempItem = new QTreeWidgetItem(); - QString tempString; - tempItem->setText(0, key.toUpper()); - for (const QJsonValue &value : jsonRoot[key].toArray()) { - tempString.append(value.toString() + " "); - } - tempItem->setText(1, tempString); - ui->regInfoTreeWidget->addTopLevelItem(tempItem); - } - - // Adjust columns to content - qhelpers::adjustColumns(ui->regInfoTreeWidget, 0); -} diff --git a/src/widgets/SidebarWidget.h b/src/widgets/SidebarWidget.h deleted file mode 100644 index 140145e7..00000000 --- a/src/widgets/SidebarWidget.h +++ /dev/null @@ -1,61 +0,0 @@ - -#ifndef SIDEBARWIDGET_H -#define SIDEBARWIDGET_H - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Cutter.h" -#include "CutterDockWidget.h" -#include "common/Highlighter.h" -#include "common/HexAsciiHighlighter.h" -#include "common/HexHighlighter.h" -#include "Dashboard.h" - - -namespace Ui { -class SidebarWidget; -} - -class SidebarWidget : public CutterDockWidget -{ - Q_OBJECT - -public: - explicit SidebarWidget(MainWindow *main, QAction *action = nullptr); - ~SidebarWidget(); - -private: - std::unique_ptr ui; - - void setFcnName(RVA addr); - void updateRefs(RVA addr); - void fillRefs(QList refs, QList xrefs); - void fillOffsetInfo(QString off); - void fillRegistersInfo(); - - void setScrollMode(); - -private slots: - void on_seekChanged(RVA addr); - - void refresh(RVA addr = RVA_INVALID); - - void on_xrefFromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column); - void on_xrefToTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column); - - void on_offsetToolButton_clicked(); - void on_opcodeDescToolButton_clicked(); - void on_xrefFromToolButton_clicked(); - void on_xrefToToolButton_clicked(); - void on_regInfoToolButton_clicked(); -}; - -#endif // SIDEBARWIDGET_H diff --git a/src/widgets/SidebarWidget.ui b/src/widgets/SidebarWidget.ui deleted file mode 100644 index f9ddf09c..00000000 --- a/src/widgets/SidebarWidget.ui +++ /dev/null @@ -1,629 +0,0 @@ - - - SidebarWidget - - - - 0 - 0 - 333 - 835 - - - - - 0 - 0 - - - - Sidebar - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 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 - 333 - 810 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 5 - - - 2 - - - 5 - - - - - 5 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 75 - true - - - - Function: - - - - - - - - - - - - - false - - - true - - - - - - - - - 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 - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - false - - - true - - - - - - - 5 - - - 0 - - - - - - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 75 - true - - - - true - - - Function registers info: - - - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - 10 - - - true - - - - Info - - - - - Value - - - - - - - - 5 - - - 0 - - - - - ... - - - - 8 - 8 - - - - true - - - true - - - Qt::DownArrow - - - - - - - - 75 - true - - - - X-Refs to current address: - - - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - QTreeWidget::item -{ - padding-top: 1px; - padding-bottom: 1px; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); - font: 12pt "Monaco"; -} - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::ScrollPerPixel - - - 8 - - - - 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-top: 1px; - padding-bottom: 1px; -} - -QToolTip { - background-color: #444; - border: 3px solid #444; - color: rgb(232, 232, 232); - font: 12pt "Monaco"; -} - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::ScrollPerPixel - - - 8 - - - - Address - - - - - Instruction - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - -