mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Small refactor for the widgets of Cutter (#405)
* Small refactor for the widgets of Cutter This refactor include the following : * Creation of a new class Creation of a new class, named CutterWidget, that inherits from QDockWidget and is used to represent all of the widgets of the main window. The goal of this class is to regroup all the behaviour shared by the widgets of Cutter. For example : in the constructor, instructions corresponding of those present in the macro **ADD_DOCK** (in MainWindow.cpp) are executed. This was made because I think that the macro **ADD_DOCK** which is used to construct the widgets does not take advantage of the object structure. * Ensure that every widget has a parent Some widgets were created using the constructor QDockWidget, but using **nullptr** (default) as argument, thus they haven't got any parent. The constructor of a CutterWidget takes as argument the MainWindow and an action (optional) and calls the constructor of QDockWidget with the main window as argument. This is valid under the assumption that it is mandatory for every widget to have the main window as a parent. * Constructors removal The constructors of some widgets are not used anywhere and does not seem not fullfill any current usecase. They were removed. * Renaming CutterWidget to CutterDockWidget
This commit is contained in:
parent
98ea17c85a
commit
c4e8a1c178
@ -142,7 +142,9 @@ SOURCES += \
|
||||
widgets/JupyterWidget.cpp \
|
||||
utils/PythonAPI.cpp \
|
||||
utils/NestedIPyKernel.cpp \
|
||||
dialogs/R2PluginsDialog.cpp
|
||||
dialogs/R2PluginsDialog.cpp \
|
||||
widgets/CutterDockWidget.cpp \
|
||||
widgets/GraphWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
Cutter.h \
|
||||
@ -209,7 +211,9 @@ HEADERS += \
|
||||
widgets/JupyterWidget.h \
|
||||
utils/PythonAPI.h \
|
||||
utils/NestedIPyKernel.h \
|
||||
dialogs/R2PluginsDialog.h
|
||||
dialogs/R2PluginsDialog.h \
|
||||
widgets/CutterDockWidget.h \
|
||||
widgets/GraphWidget.h
|
||||
|
||||
FORMS += \
|
||||
dialogs/AboutDialog.ui \
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include "dialogs/NewFileDialog.h"
|
||||
#include "widgets/DisassemblerGraphView.h"
|
||||
#include "widgets/GraphWidget.h"
|
||||
#include "widgets/FunctionsWidget.h"
|
||||
#include "widgets/SectionsWidget.h"
|
||||
#include "widgets/CommentsWidget.h"
|
||||
@ -150,78 +151,44 @@ void MainWindow::initUI()
|
||||
*/
|
||||
dockWidgets.reserve(20);
|
||||
|
||||
#define ADD_DOCK(cls, dockMember, action) \
|
||||
{ \
|
||||
(dockMember) = new cls(this); \
|
||||
dockWidgets.push_back(dockMember); \
|
||||
connect((action), &QAction::triggered, this, [this](bool checked) \
|
||||
{ \
|
||||
toggleDockWidget((dockMember), checked); \
|
||||
}); \
|
||||
dockWidgetActions[action] = (dockMember); \
|
||||
}
|
||||
ADD_DOCK(DisassemblyWidget, disassemblyDock, ui->actionDisassembly);
|
||||
ADD_DOCK(SidebarWidget, sidebarDock, ui->actionSidebar);
|
||||
ADD_DOCK(HexdumpWidget, hexdumpDock, ui->actionHexdump);
|
||||
ADD_DOCK(PseudocodeWidget, pseudocodeDock, ui->actionPseudocode);
|
||||
ADD_DOCK(ConsoleWidget, consoleDock, ui->actionConsole);
|
||||
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);
|
||||
|
||||
// Add graph view as dockable
|
||||
graphDock = new QDockWidget(tr("Graph"), this);
|
||||
graphDock->setObjectName("Graph");
|
||||
graphDock->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||
graphView = new DisassemblerGraphView(graphDock);
|
||||
graphDock->setWidget(graphView);
|
||||
graphDock = new GraphWidget(this, ui->actionGraph);
|
||||
|
||||
// Hide centralWidget as we do not need it
|
||||
ui->centralWidget->hide();
|
||||
|
||||
connect(graphDock, &QDockWidget::visibilityChanged, graphDock, [](bool visibility)
|
||||
{
|
||||
if (visibility)
|
||||
{
|
||||
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Graph);
|
||||
}
|
||||
});
|
||||
connect(Core(), &CutterCore::raisePrioritizedMemoryWidget, graphDock, [ = ](CutterCore::MemoryWidgetType type)
|
||||
{
|
||||
if (type == CutterCore::MemoryWidgetType::Graph)
|
||||
{
|
||||
graphDock->raise();
|
||||
graphView->setFocus();
|
||||
}
|
||||
});
|
||||
dockWidgets.push_back(graphDock);
|
||||
connect(ui->actionGraph, &QAction::triggered, this, [this](bool checked)
|
||||
{
|
||||
toggleDockWidget(graphDock, checked);
|
||||
});
|
||||
|
||||
ADD_DOCK(SectionsDock, sectionsDock, ui->actionSections);
|
||||
ADD_DOCK(EntrypointWidget, entrypointDock, ui->actionEntrypoints);
|
||||
ADD_DOCK(FunctionsWidget, functionsDock, ui->actionFunctions);
|
||||
ADD_DOCK(ImportsWidget, importsDock, ui->actionImports);
|
||||
ADD_DOCK(ExportsWidget, exportsDock, ui->actionExports);
|
||||
ADD_DOCK(TypesWidget, typesDock, ui->actionTypes);
|
||||
ADD_DOCK(SearchWidget, searchDock, ui->actionSearchInst);
|
||||
ADD_DOCK(SymbolsWidget, symbolsDock, ui->actionSymbols);
|
||||
ADD_DOCK(RelocsWidget, relocsDock, ui->actionRelocs);
|
||||
ADD_DOCK(CommentsWidget, commentsDock, ui->actionComments);
|
||||
ADD_DOCK(StringsWidget, stringsDock, ui->actionStrings);
|
||||
ADD_DOCK(FlagsWidget, flagsDock, ui->actionFlags);
|
||||
sectionsDock = new SectionsDock(this, ui->actionSections);
|
||||
disassemblyDock = new DisassemblyWidget(this, ui->actionDisassembly);
|
||||
entrypointDock = new EntrypointWidget(this, ui->actionEntrypoints);
|
||||
functionsDock = new FunctionsWidget(this, ui->actionFunctions);
|
||||
importsDock = new ImportsWidget(this, ui->actionImports);
|
||||
exportsDock = new ExportsWidget(this, ui->actionExports);
|
||||
typesDock = new TypesWidget(this, ui->actionTypes);
|
||||
searchDock = new SearchWidget(this, ui->actionSearch);
|
||||
symbolsDock = new SymbolsWidget(this, ui->actionSymbols);
|
||||
relocsDock = new RelocsWidget(this, ui->actionRelocs);
|
||||
commentsDock = new CommentsWidget(this, ui->actionComments);
|
||||
stringsDock = new StringsWidget(this, ui->actionStrings);
|
||||
flagsDock = new FlagsWidget(this, ui->actionFlags);
|
||||
#ifdef CUTTER_ENABLE_JUPYTER
|
||||
ADD_DOCK(JupyterWidget, jupyterDock, ui->actionJupyter);
|
||||
jupyterDock = new JupyterWidget(this, ui->actionJupyter);
|
||||
#else
|
||||
ui->actionJupyter->setEnabled(false);
|
||||
ui->actionJupyter->setVisible(false);
|
||||
#endif
|
||||
ADD_DOCK(Dashboard, dashboardDock, ui->actionDashboard);
|
||||
ADD_DOCK(SdbDock, sdbDock, ui->actionSDBBrowser);
|
||||
ADD_DOCK(ClassesWidget, classesDock, ui->actionClasses);
|
||||
ADD_DOCK(ResourcesWidget, resourcesDock, ui->actionResources);
|
||||
ADD_DOCK(VTablesWidget, vTablesDock, ui->actionVTables);
|
||||
dashboardDock = new Dashboard(this, ui->actionDashboard);
|
||||
disassemblyDock = new DisassemblyWidget(this, ui->actionDisassembly);
|
||||
sdbDock = new SdbDock(this, ui->actionSDBBrowser);
|
||||
classesDock = new ClassesWidget(this, ui->actionClasses);
|
||||
resourcesDock = new ResourcesWidget(this, ui->actionResources);
|
||||
vTablesDock = new VTablesWidget(this, ui->actionVTables);
|
||||
|
||||
#undef ADD_DOCK
|
||||
|
||||
// Set up dock widgets default layout
|
||||
resetToDefaultLayout();
|
||||
@ -484,19 +451,6 @@ void MainWindow::lockUnlock_Docks(bool what)
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::toggleDockWidget(QDockWidget *dock_widget, bool show)
|
||||
{
|
||||
if (!show)
|
||||
{
|
||||
dock_widget->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
dock_widget->show();
|
||||
dock_widget->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::restoreDocks()
|
||||
{
|
||||
// In the upper half the functions are the first widget
|
||||
@ -808,3 +762,11 @@ void MainWindow::projectSaved(const QString &name)
|
||||
{
|
||||
addOutput(tr("Project saved: ") + name);
|
||||
}
|
||||
|
||||
void MainWindow::addToDockWidgetList(QDockWidget *dockWidget) {
|
||||
this->dockWidgets.push_back(dockWidget);
|
||||
}
|
||||
|
||||
void MainWindow::addDockWidgetAction(QDockWidget *dockWidget, QAction *action) {
|
||||
this->dockWidgetActions[action] = dockWidget;
|
||||
}
|
||||
|
@ -91,6 +91,9 @@ public:
|
||||
void addDebugOutput(const QString &msg);
|
||||
void refreshOmniBar(const QStringList &flags);
|
||||
|
||||
void addToDockWidgetList(QDockWidget *dockWidget);
|
||||
void addDockWidgetAction(QDockWidget *dockWidget, QAction *action);
|
||||
|
||||
public slots:
|
||||
|
||||
void refreshAll();
|
||||
@ -198,8 +201,6 @@ private:
|
||||
JupyterWidget *jupyterDock = nullptr;
|
||||
#endif
|
||||
|
||||
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
||||
|
||||
void resetToDefaultLayout();
|
||||
|
||||
void restoreDocks();
|
||||
@ -207,6 +208,8 @@ private:
|
||||
void showDefaultDocks();
|
||||
void updateDockActionsChecked();
|
||||
|
||||
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
||||
|
||||
public:
|
||||
QString getFilename() const { return filename; }
|
||||
};
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <QList>
|
||||
|
||||
#include "ClassesWidget.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ui_ClassesWidget.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
@ -242,8 +243,8 @@ bool ClassesSortFilterProxyModel::lessThan(const QModelIndex &left, const QModel
|
||||
|
||||
|
||||
|
||||
ClassesWidget::ClassesWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ClassesWidget::ClassesWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::ClassesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -16,6 +16,7 @@ namespace Ui
|
||||
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
class MainWindow;
|
||||
|
||||
|
||||
class ClassesModel: public QAbstractItemModel
|
||||
@ -65,12 +66,12 @@ protected:
|
||||
|
||||
|
||||
|
||||
class ClassesWidget : public QDockWidget
|
||||
class ClassesWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClassesWidget(QWidget *parent = nullptr);
|
||||
explicit ClassesWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~ClassesWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "MainWindow.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
CommentsWidget::CommentsWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::CommentsWidget),
|
||||
main(main)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -13,12 +13,12 @@ namespace Ui
|
||||
class CommentsWidget;
|
||||
}
|
||||
|
||||
class CommentsWidget : public QDockWidget
|
||||
class CommentsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CommentsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit CommentsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~CommentsWidget();
|
||||
|
||||
protected:
|
||||
|
@ -90,8 +90,8 @@ static bool isForbidden(const QString &input)
|
||||
return false;
|
||||
}
|
||||
|
||||
ConsoleWidget::ConsoleWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QDockWidget(parent, flags),
|
||||
ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::ConsoleWidget),
|
||||
debugOutputEnabled(true),
|
||||
maxHistoryEntries(100),
|
||||
@ -110,9 +110,9 @@ ConsoleWidget::ConsoleWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QTextDocument *console_docu = ui->outputTextEdit->document();
|
||||
console_docu->setDocumentMargin(10);
|
||||
|
||||
QAction *action = new QAction(tr("Clear Output"), ui->outputTextEdit);
|
||||
connect(action, SIGNAL(triggered(bool)), ui->outputTextEdit, SLOT(clear()));
|
||||
actions.append(action);
|
||||
QAction *actionClear = new QAction(tr("Clear Output"), ui->outputTextEdit);
|
||||
connect(actionClear, SIGNAL(triggered(bool)), ui->outputTextEdit, SLOT(clear()));
|
||||
actions.append(actionClear);
|
||||
|
||||
// Completion
|
||||
QCompleter *completer = new QCompleter(radareArgs, this);
|
||||
@ -144,12 +144,6 @@ ConsoleWidget::ConsoleWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(setupFont()));
|
||||
}
|
||||
|
||||
ConsoleWidget::ConsoleWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags)
|
||||
: ConsoleWidget(parent, flags)
|
||||
{
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
ConsoleWidget::~ConsoleWidget() {}
|
||||
|
||||
void ConsoleWidget::setupFont()
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef CONSOLEWIDGET_H
|
||||
#define CONSOLEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
#include "MainWindow.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -11,13 +11,12 @@ namespace Ui
|
||||
}
|
||||
|
||||
|
||||
class ConsoleWidget : public QDockWidget
|
||||
class ConsoleWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConsoleWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit ConsoleWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit ConsoleWidget(MainWindow *main, QAction *action = nullptr);
|
||||
|
||||
~ConsoleWidget();
|
||||
|
||||
|
37
src/widgets/CutterDockWidget.cpp
Normal file
37
src/widgets/CutterDockWidget.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "CutterDockWidget.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
|
||||
CutterDockWidget::CutterDockWidget(MainWindow *main, QAction *action) :
|
||||
QDockWidget(main),
|
||||
action(action)
|
||||
{
|
||||
main->addToDockWidgetList(this);
|
||||
if (action) {
|
||||
main->addDockWidgetAction(this, action);
|
||||
connect(action, &QAction::triggered, this, &CutterDockWidget::toggleDockWidget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CutterDockWidget::toggleDockWidget(bool show)
|
||||
{
|
||||
if (!show)
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->show();
|
||||
this->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void CutterDockWidget::closeEvent(QCloseEvent * event) {
|
||||
if (action) {
|
||||
this->action->setChecked(false);
|
||||
}
|
||||
QDockWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
CutterDockWidget::~CutterDockWidget() {}
|
27
src/widgets/CutterDockWidget.h
Normal file
27
src/widgets/CutterDockWidget.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef CUTTERWIDGET_H
|
||||
#define CUTTERWIDGET_H
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class CutterDockWidget : public QDockWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CutterDockWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~CutterDockWidget();
|
||||
public slots:
|
||||
void toggleDockWidget(bool show);
|
||||
|
||||
|
||||
private:
|
||||
QAction *action;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * event) override;
|
||||
};
|
||||
|
||||
#endif // CUTTERWIDGET_H
|
@ -12,11 +12,9 @@
|
||||
#include <QFile>
|
||||
#include <QLayoutItem>
|
||||
|
||||
|
||||
Dashboard::Dashboard(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::Dashboard),
|
||||
main(main)
|
||||
Dashboard::Dashboard(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::Dashboard)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
#define DASHBOARD_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
|
||||
@ -12,12 +11,12 @@ namespace Ui
|
||||
class Dashboard;
|
||||
}
|
||||
|
||||
class Dashboard : public QDockWidget
|
||||
class Dashboard : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dashboard(MainWindow *main, QWidget *parent = 0);
|
||||
explicit Dashboard(MainWindow *main, QAction *action = nullptr);
|
||||
~Dashboard();
|
||||
|
||||
private slots:
|
||||
@ -25,7 +24,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::Dashboard> ui;
|
||||
MainWindow *main;
|
||||
};
|
||||
|
||||
#endif // DASHBOARD_H
|
||||
|
@ -37,8 +37,8 @@ static DisassemblyTextBlockUserData *getUserData(const QTextBlock &block)
|
||||
}
|
||||
|
||||
|
||||
DisassemblyWidget::DisassemblyWidget(QWidget *parent)
|
||||
: QDockWidget(parent)
|
||||
DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action)
|
||||
: CutterDockWidget(main, action)
|
||||
, mCtxMenu(new DisassemblyContextMenu(this))
|
||||
, mDisasScrollArea(new DisassemblyScrollArea(this))
|
||||
, mDisasTextEdit(new DisassemblyTextEdit(this))
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define DISASSEMBLYWIDGET_H
|
||||
|
||||
#include "Cutter.h"
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
#include <QTextEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QShortcut>
|
||||
@ -12,11 +12,11 @@ class DisassemblyTextEdit;
|
||||
class DisassemblyScrollArea;
|
||||
class DisassemblyContextMenu;
|
||||
|
||||
class DisassemblyWidget : public QDockWidget
|
||||
class DisassemblyWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DisassemblyWidget(QWidget *parent = nullptr);
|
||||
explicit DisassemblyWidget(MainWindow *main, QAction *action = nullptr);
|
||||
QWidget* getTextWidget();
|
||||
|
||||
public slots:
|
||||
|
@ -12,10 +12,9 @@
|
||||
* Entrypoint Widget
|
||||
*/
|
||||
|
||||
EntrypointWidget::EntrypointWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::EntrypointWidget),
|
||||
main(main)
|
||||
EntrypointWidget::EntrypointWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::EntrypointWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
#define ENTRYPOINTWIDGET_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
|
||||
@ -15,12 +15,12 @@ namespace Ui
|
||||
class EntrypointWidget;
|
||||
}
|
||||
|
||||
class EntrypointWidget : public QDockWidget
|
||||
class EntrypointWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EntrypointWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit EntrypointWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~EntrypointWidget();
|
||||
|
||||
private slots:
|
||||
@ -30,7 +30,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::EntrypointWidget> ui;
|
||||
MainWindow *main;
|
||||
|
||||
void setScrollMode();
|
||||
};
|
||||
|
@ -129,16 +129,12 @@ bool ExportsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModel
|
||||
|
||||
|
||||
|
||||
ExportsWidget::ExportsWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::ExportsWidget),
|
||||
main(main)
|
||||
ExportsWidget::ExportsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::ExportsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Radare core found in:
|
||||
this->main = main;
|
||||
|
||||
exports_model = new ExportsModel(&exports, this);
|
||||
exports_proxy_model = new ExportsSortFilterProxyModel(exports_model, this);
|
||||
ui->exportsTreeView->setModel(exports_proxy_model);
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
@ -61,12 +61,12 @@ protected:
|
||||
|
||||
|
||||
|
||||
class ExportsWidget : public QDockWidget
|
||||
class ExportsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExportsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit ExportsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~ExportsWidget();
|
||||
|
||||
private slots:
|
||||
@ -76,7 +76,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::ExportsWidget> ui;
|
||||
MainWindow *main;
|
||||
|
||||
ExportsModel *exports_model;
|
||||
ExportsSortFilterProxyModel *exports_proxy_model;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include <QDockWidget>
|
||||
#include <QTreeWidget>
|
||||
#include <QComboBox>
|
||||
#include <QMenu>
|
||||
@ -127,8 +126,8 @@ bool FlagsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
|
||||
}
|
||||
|
||||
|
||||
FlagsWidget::FlagsWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
FlagsWidget::FlagsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::FlagsWidget),
|
||||
main(main)
|
||||
{
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -57,12 +57,12 @@ namespace Ui
|
||||
class FlagsWidget;
|
||||
}
|
||||
|
||||
class FlagsWidget : public QDockWidget
|
||||
class FlagsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FlagsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit FlagsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~FlagsWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -347,10 +347,9 @@ bool FunctionSortFilterProxyModel::lessThan(const QModelIndex &left, const QMode
|
||||
}
|
||||
}
|
||||
|
||||
FunctionsWidget::FunctionsWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::FunctionsWidget),
|
||||
main(main)
|
||||
FunctionsWidget::FunctionsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::FunctionsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QTreeView>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -86,12 +86,12 @@ protected:
|
||||
|
||||
|
||||
|
||||
class FunctionsWidget : public QDockWidget
|
||||
class FunctionsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FunctionsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit FunctionsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~FunctionsWidget();
|
||||
|
||||
private slots:
|
||||
|
34
src/widgets/GraphWidget.cpp
Normal file
34
src/widgets/GraphWidget.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "MainWindow.h"
|
||||
#include "GraphWidget.h"
|
||||
#include "DisassemblerGraphView.h"
|
||||
|
||||
GraphWidget::GraphWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action)
|
||||
{
|
||||
this->setObjectName("Graph");
|
||||
this->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||
this->graphView = new DisassemblerGraphView(this);
|
||||
this->setWidget(graphView);
|
||||
|
||||
connect(this, &QDockWidget::visibilityChanged, this, [](bool visibility)
|
||||
{
|
||||
if (visibility)
|
||||
{
|
||||
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Graph);
|
||||
}
|
||||
});
|
||||
|
||||
connect(Core(), &CutterCore::raisePrioritizedMemoryWidget, this, [ = ](CutterCore::MemoryWidgetType type)
|
||||
{
|
||||
if (type == CutterCore::MemoryWidgetType::Graph)
|
||||
{
|
||||
this->raise();
|
||||
this->graphView->setFocus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
GraphWidget::~GraphWidget() {}
|
22
src/widgets/GraphWidget.h
Normal file
22
src/widgets/GraphWidget.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef GRAPHWIDGET_H
|
||||
#define GRAPHWIDGET_H
|
||||
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class DisassemblerGraphView;
|
||||
|
||||
class GraphWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GraphWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~GraphWidget();
|
||||
|
||||
private:
|
||||
DisassemblerGraphView *graphView;
|
||||
|
||||
};
|
||||
|
||||
#endif // GRAPHWIDGET_H
|
@ -13,8 +13,8 @@
|
||||
#include <QClipboard>
|
||||
#include <QScrollBar>
|
||||
|
||||
HexdumpWidget::HexdumpWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QDockWidget(parent, flags),
|
||||
HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::HexdumpWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -85,12 +85,6 @@ HexdumpWidget::HexdumpWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
selectHexPreview();
|
||||
}
|
||||
|
||||
HexdumpWidget::HexdumpWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags)
|
||||
: HexdumpWidget(parent, flags)
|
||||
{
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
void HexdumpWidget::setupScrollSync()
|
||||
{
|
||||
/*
|
||||
|
@ -3,13 +3,13 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTextEdit>
|
||||
#include <QDockWidget>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
#include "utils/Highlighter.h"
|
||||
#include "utils/HexAsciiHighlighter.h"
|
||||
#include "utils/HexHighlighter.h"
|
||||
@ -19,14 +19,13 @@
|
||||
|
||||
#include "ui_HexdumpWidget.h"
|
||||
|
||||
class HexdumpWidget : public QDockWidget
|
||||
class HexdumpWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit HexdumpWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit HexdumpWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit HexdumpWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~HexdumpWidget();
|
||||
|
||||
Highlighter *highlighter;
|
||||
|
@ -32,10 +32,9 @@ void CMyDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, c
|
||||
* Imports Widget
|
||||
*/
|
||||
|
||||
ImportsWidget::ImportsWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::ImportsWidget),
|
||||
main(main)
|
||||
ImportsWidget::ImportsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::ImportsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -3,10 +3,11 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
|
||||
@ -15,12 +16,12 @@ namespace Ui
|
||||
class ImportsWidget;
|
||||
}
|
||||
|
||||
class ImportsWidget : public QDockWidget
|
||||
class ImportsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImportsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit ImportsWidget(MainWindow *main, QAction *action);
|
||||
~ImportsWidget();
|
||||
|
||||
private slots:
|
||||
@ -30,7 +31,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::ImportsWidget> ui;
|
||||
MainWindow *main;
|
||||
|
||||
void highlightUnsafe();
|
||||
void setScrollMode();
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include <QWebEngineSettings>
|
||||
#endif
|
||||
|
||||
JupyterWidget::JupyterWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QDockWidget(parent, flags),
|
||||
JupyterWidget::JupyterWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::JupyterWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QAbstractButton>
|
||||
|
||||
#include "CutterDockWidget.h"
|
||||
#include "utils/JupyterConnection.h"
|
||||
|
||||
namespace Ui
|
||||
@ -17,15 +17,15 @@ namespace Ui
|
||||
}
|
||||
|
||||
class JupyterWebView;
|
||||
|
||||
class QTabWidget;
|
||||
class MainWindow;
|
||||
|
||||
class JupyterWidget : public QDockWidget
|
||||
class JupyterWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
JupyterWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
JupyterWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~JupyterWidget();
|
||||
|
||||
#ifdef CUTTER_ENABLE_QTWEBENGINE
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "utils/SyntaxHighlighter.h"
|
||||
#include "utils/TempConfig.h"
|
||||
|
||||
PseudocodeWidget::PseudocodeWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QDockWidget(parent, flags),
|
||||
PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::PseudocodeWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -47,12 +47,6 @@ PseudocodeWidget::PseudocodeWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
refresh(RVA_INVALID);
|
||||
}
|
||||
|
||||
PseudocodeWidget::PseudocodeWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags)
|
||||
: PseudocodeWidget(parent, flags)
|
||||
{
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
PseudocodeWidget::~PseudocodeWidget() {}
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef PSEUDOCODEWIDGET_H
|
||||
#define PSEUDOCODEWIDGET_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -14,13 +14,12 @@ namespace Ui
|
||||
class QTextEdit;
|
||||
class SyntaxHighlighter;
|
||||
|
||||
class PseudocodeWidget : public QDockWidget
|
||||
class PseudocodeWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PseudocodeWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit PseudocodeWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit PseudocodeWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~PseudocodeWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -4,16 +4,12 @@
|
||||
#include "MainWindow.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
RelocsWidget::RelocsWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::RelocsWidget),
|
||||
main(main)
|
||||
RelocsWidget::RelocsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::RelocsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Radare core found in:
|
||||
this->main = main;
|
||||
|
||||
setScrollMode();
|
||||
|
||||
connect(Core(), SIGNAL(refreshAll()), this, SLOT(fillTreeWidget()));
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -13,12 +13,12 @@ namespace Ui
|
||||
class RelocsWidget;
|
||||
}
|
||||
|
||||
class RelocsWidget : public QDockWidget
|
||||
class RelocsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RelocsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit RelocsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~RelocsWidget();
|
||||
|
||||
private slots:
|
||||
@ -28,7 +28,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::RelocsWidget> ui;
|
||||
MainWindow *main;
|
||||
|
||||
void setScrollMode();
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "utils/Helpers.h"
|
||||
#include "ResourcesWidget.h"
|
||||
#include "MainWindow.h"
|
||||
#include <QVBoxLayout>
|
||||
|
||||
ResourcesModel::ResourcesModel(QList<ResourcesDescription> *resources, QObject *parent)
|
||||
@ -86,8 +87,8 @@ void ResourcesModel::endReload()
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
ResourcesWidget::ResourcesWidget(QWidget *parent)
|
||||
: QDockWidget(parent)
|
||||
ResourcesWidget::ResourcesWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action)
|
||||
{
|
||||
setObjectName("ResourcesWidget");
|
||||
|
||||
|
@ -2,11 +2,13 @@
|
||||
#define RESOURCESWIDGET_H
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QAbstractListModel>
|
||||
#include <QTreeView>
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class ResourcesModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -28,7 +30,7 @@ public:
|
||||
void endReload();
|
||||
};
|
||||
|
||||
class ResourcesWidget : public QDockWidget
|
||||
class ResourcesWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -38,7 +40,7 @@ private:
|
||||
QList<ResourcesDescription> resources;
|
||||
|
||||
public:
|
||||
ResourcesWidget(QWidget *parent = nullptr);
|
||||
explicit ResourcesWidget(MainWindow *main, QAction *action = nullptr);
|
||||
|
||||
private slots:
|
||||
void refreshResources();
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
||||
SdbDock::SdbDock(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
SdbDock::SdbDock(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::SdbDock)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -13,12 +13,12 @@ namespace Ui
|
||||
class SdbDock;
|
||||
}
|
||||
|
||||
class SdbDock : public QDockWidget
|
||||
class SdbDock : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SdbDock(QWidget *parent = 0);
|
||||
explicit SdbDock(MainWindow *main, QAction *action = nullptr);
|
||||
~SdbDock();
|
||||
|
||||
private slots:
|
||||
|
@ -122,10 +122,9 @@ bool SearchSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelI
|
||||
}
|
||||
|
||||
|
||||
SearchWidget::SearchWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::SearchWidget),
|
||||
main(main)
|
||||
SearchWidget::SearchWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::SearchWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -57,12 +57,12 @@ namespace Ui
|
||||
class SearchWidget;
|
||||
}
|
||||
|
||||
class SearchWidget : public QDockWidget
|
||||
class SearchWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SearchWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit SearchWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~SearchWidget();
|
||||
|
||||
private slots:
|
||||
@ -73,7 +73,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::SearchWidget> ui;
|
||||
MainWindow *main;
|
||||
|
||||
SearchModel *search_model;
|
||||
SearchSortFilterProxyModel *search_proxy_model;
|
||||
|
@ -8,15 +8,13 @@
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
||||
SectionsDock::SectionsDock(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::SectionsDock)
|
||||
SectionsDock::SectionsDock(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::SectionsDock),
|
||||
main(main)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Radare core found in:
|
||||
this->main = main;
|
||||
|
||||
this->sectionsWidget = new SectionsWidget(this->main);
|
||||
this->setWidget(this->sectionsWidget);
|
||||
this->sectionsWidget->setContentsMargins(0, 0, 0, 5);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class SectionsWidget;
|
||||
@ -13,12 +13,12 @@ namespace Ui
|
||||
class SectionsDock;
|
||||
}
|
||||
|
||||
class SectionsDock : public QDockWidget
|
||||
class SectionsDock : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SectionsDock(MainWindow *main, QWidget *parent = 0);
|
||||
explicit SectionsDock(MainWindow *main, QAction *action = nullptr);
|
||||
~SectionsDock();
|
||||
|
||||
protected:
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
SidebarWidget::SidebarWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
QDockWidget(parent, flags),
|
||||
SidebarWidget::SidebarWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::SidebarWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -35,13 +35,6 @@ SidebarWidget::SidebarWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refresh()));
|
||||
}
|
||||
|
||||
SidebarWidget::SidebarWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags)
|
||||
: SidebarWidget(parent, flags)
|
||||
{
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
|
||||
SidebarWidget::~SidebarWidget()
|
||||
{
|
||||
}
|
||||
|
@ -5,14 +5,15 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTextEdit>
|
||||
#include <QDockWidget>
|
||||
#include <QTreeWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QUrl>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMouseEvent>
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
#include "utils/Highlighter.h"
|
||||
#include "utils/HexAsciiHighlighter.h"
|
||||
#include "utils/HexHighlighter.h"
|
||||
@ -24,13 +25,12 @@ namespace Ui
|
||||
class SidebarWidget;
|
||||
}
|
||||
|
||||
class SidebarWidget : public QDockWidget
|
||||
class SidebarWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SidebarWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit SidebarWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||
explicit SidebarWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~SidebarWidget();
|
||||
|
||||
private:
|
||||
|
@ -132,8 +132,8 @@ bool StringsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModel
|
||||
}
|
||||
|
||||
|
||||
StringsWidget::StringsWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
StringsWidget::StringsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::StringsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -55,12 +55,12 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class StringsWidget : public QDockWidget
|
||||
class StringsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StringsWidget(QWidget *parent = nullptr);
|
||||
explicit StringsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~StringsWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
||||
SymbolsWidget::SymbolsWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
SymbolsWidget::SymbolsWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::SymbolsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDockWidget>
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
@ -13,12 +13,12 @@ namespace Ui
|
||||
class SymbolsWidget;
|
||||
}
|
||||
|
||||
class SymbolsWidget : public QDockWidget
|
||||
class SymbolsWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SymbolsWidget(QWidget *parent = 0);
|
||||
explicit SymbolsWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~SymbolsWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -113,16 +113,12 @@ bool TypesSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
|
||||
|
||||
|
||||
|
||||
TypesWidget::TypesWidget(MainWindow *main, QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::TypesWidget),
|
||||
main(main)
|
||||
TypesWidget::TypesWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::TypesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Radare core found in:
|
||||
this->main = main;
|
||||
|
||||
types_model = new TypesModel(&types, this);
|
||||
types_proxy_model = new TypesSortFilterProxyModel(types_model, this);
|
||||
ui->typesTreeView->setModel(types_proxy_model);
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
@ -61,12 +61,12 @@ protected:
|
||||
|
||||
|
||||
|
||||
class TypesWidget : public QDockWidget
|
||||
class TypesWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TypesWidget(MainWindow *main, QWidget *parent = 0);
|
||||
explicit TypesWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~TypesWidget();
|
||||
|
||||
private slots:
|
||||
@ -76,7 +76,6 @@ private slots:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::TypesWidget> ui;
|
||||
MainWindow *main;
|
||||
|
||||
TypesModel *types_model;
|
||||
TypesSortFilterProxyModel *types_proxy_model;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <QShortcut>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "VTablesWidget.h"
|
||||
#include "ui_VTablesWidget.h"
|
||||
|
||||
@ -142,8 +143,8 @@ bool VTableSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIn
|
||||
}
|
||||
|
||||
|
||||
VTablesWidget::VTablesWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
VTablesWidget::VTablesWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::VTablesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -5,15 +5,17 @@
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "CutterDockWidget.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class VTablesWidget;
|
||||
}
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class VTableModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -49,12 +51,12 @@ protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
||||
};
|
||||
|
||||
class VTablesWidget : public QDockWidget
|
||||
class VTablesWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VTablesWidget(QWidget *parent = 0);
|
||||
explicit VTablesWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~VTablesWidget();
|
||||
|
||||
private slots:
|
||||
|
Loading…
Reference in New Issue
Block a user