diff --git a/src/Cutter.pro b/src/Cutter.pro index 45ca9099..1ab3dc5d 100644 --- a/src/Cutter.pro +++ b/src/Cutter.pro @@ -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 \ diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 6dfb524c..816db745 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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; +} diff --git a/src/MainWindow.h b/src/MainWindow.h index 900914ba..f52fff78 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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; } }; diff --git a/src/widgets/ClassesWidget.cpp b/src/widgets/ClassesWidget.cpp index ad66a347..3d50a818 100644 --- a/src/widgets/ClassesWidget.cpp +++ b/src/widgets/ClassesWidget.cpp @@ -2,6 +2,7 @@ #include #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); diff --git a/src/widgets/ClassesWidget.h b/src/widgets/ClassesWidget.h index 30fccfba..614eff8d 100644 --- a/src/widgets/ClassesWidget.h +++ b/src/widgets/ClassesWidget.h @@ -4,10 +4,10 @@ #include #include "Cutter.h" +#include "CutterDockWidget.h" #include #include -#include 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: diff --git a/src/widgets/CommentsWidget.cpp b/src/widgets/CommentsWidget.cpp index f3984a29..412d83ae 100644 --- a/src/widgets/CommentsWidget.cpp +++ b/src/widgets/CommentsWidget.cpp @@ -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) { diff --git a/src/widgets/CommentsWidget.h b/src/widgets/CommentsWidget.h index 61049063..ba174aac 100644 --- a/src/widgets/CommentsWidget.h +++ b/src/widgets/CommentsWidget.h @@ -3,7 +3,7 @@ #include -#include +#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: diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp index bb87afe7..4381fe48 100644 --- a/src/widgets/ConsoleWidget.cpp +++ b/src/widgets/ConsoleWidget.cpp @@ -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() diff --git a/src/widgets/ConsoleWidget.h b/src/widgets/ConsoleWidget.h index 72ba2789..ed447edf 100644 --- a/src/widgets/ConsoleWidget.h +++ b/src/widgets/ConsoleWidget.h @@ -1,9 +1,9 @@ #ifndef CONSOLEWIDGET_H #define CONSOLEWIDGET_H -#include #include #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(); diff --git a/src/widgets/CutterDockWidget.cpp b/src/widgets/CutterDockWidget.cpp new file mode 100644 index 00000000..cce88f63 --- /dev/null +++ b/src/widgets/CutterDockWidget.cpp @@ -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() {} diff --git a/src/widgets/CutterDockWidget.h b/src/widgets/CutterDockWidget.h new file mode 100644 index 00000000..7b6c5bb9 --- /dev/null +++ b/src/widgets/CutterDockWidget.h @@ -0,0 +1,27 @@ +#ifndef CUTTERWIDGET_H +#define CUTTERWIDGET_H + +#include + +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 diff --git a/src/widgets/Dashboard.cpp b/src/widgets/Dashboard.cpp index aa39bf3e..80c6affc 100644 --- a/src/widgets/Dashboard.cpp +++ b/src/widgets/Dashboard.cpp @@ -12,11 +12,9 @@ #include #include - -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); diff --git a/src/widgets/Dashboard.h b/src/widgets/Dashboard.h index 1127798b..4fca9131 100644 --- a/src/widgets/Dashboard.h +++ b/src/widgets/Dashboard.h @@ -2,8 +2,7 @@ #define DASHBOARD_H #include - -#include +#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; - MainWindow *main; }; #endif // DASHBOARD_H diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index 92a1ef7b..0dc5a9d3 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -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)) diff --git a/src/widgets/DisassemblyWidget.h b/src/widgets/DisassemblyWidget.h index 96b8592a..cef96247 100644 --- a/src/widgets/DisassemblyWidget.h +++ b/src/widgets/DisassemblyWidget.h @@ -2,7 +2,7 @@ #define DISASSEMBLYWIDGET_H #include "Cutter.h" -#include +#include "CutterDockWidget.h" #include #include #include @@ -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: diff --git a/src/widgets/EntrypointWidget.cpp b/src/widgets/EntrypointWidget.cpp index 76126418..f2877dc9 100644 --- a/src/widgets/EntrypointWidget.cpp +++ b/src/widgets/EntrypointWidget.cpp @@ -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); diff --git a/src/widgets/EntrypointWidget.h b/src/widgets/EntrypointWidget.h index 84491007..7b621a93 100644 --- a/src/widgets/EntrypointWidget.h +++ b/src/widgets/EntrypointWidget.h @@ -2,11 +2,11 @@ #define ENTRYPOINTWIDGET_H #include - -#include #include #include +#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; - MainWindow *main; void setScrollMode(); }; diff --git a/src/widgets/ExportsWidget.cpp b/src/widgets/ExportsWidget.cpp index 12cb1bb6..4100a004 100644 --- a/src/widgets/ExportsWidget.cpp +++ b/src/widgets/ExportsWidget.cpp @@ -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); diff --git a/src/widgets/ExportsWidget.h b/src/widgets/ExportsWidget.h index c0467925..04491715 100644 --- a/src/widgets/ExportsWidget.h +++ b/src/widgets/ExportsWidget.h @@ -4,10 +4,10 @@ #include #include "Cutter.h" +#include "CutterDockWidget.h" #include #include -#include 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; - MainWindow *main; ExportsModel *exports_model; ExportsSortFilterProxyModel *exports_proxy_model; diff --git a/src/widgets/FlagsWidget.cpp b/src/widgets/FlagsWidget.cpp index cb762bd7..a39822c9 100644 --- a/src/widgets/FlagsWidget.cpp +++ b/src/widgets/FlagsWidget.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -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) { diff --git a/src/widgets/FlagsWidget.h b/src/widgets/FlagsWidget.h index 9a34cdaf..2d9bc0bd 100644 --- a/src/widgets/FlagsWidget.h +++ b/src/widgets/FlagsWidget.h @@ -5,9 +5,9 @@ #include #include -#include #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: diff --git a/src/widgets/FunctionsWidget.cpp b/src/widgets/FunctionsWidget.cpp index dd1b9c03..10f81e23 100644 --- a/src/widgets/FunctionsWidget.cpp +++ b/src/widgets/FunctionsWidget.cpp @@ -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); diff --git a/src/widgets/FunctionsWidget.h b/src/widgets/FunctionsWidget.h index 38f44ed7..600fe667 100644 --- a/src/widgets/FunctionsWidget.h +++ b/src/widgets/FunctionsWidget.h @@ -5,9 +5,9 @@ #include #include -#include #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: diff --git a/src/widgets/GraphWidget.cpp b/src/widgets/GraphWidget.cpp new file mode 100644 index 00000000..9bec1c30 --- /dev/null +++ b/src/widgets/GraphWidget.cpp @@ -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() {} diff --git a/src/widgets/GraphWidget.h b/src/widgets/GraphWidget.h new file mode 100644 index 00000000..dd766841 --- /dev/null +++ b/src/widgets/GraphWidget.h @@ -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 diff --git a/src/widgets/HexdumpWidget.cpp b/src/widgets/HexdumpWidget.cpp index eb530764..9afb93fd 100644 --- a/src/widgets/HexdumpWidget.cpp +++ b/src/widgets/HexdumpWidget.cpp @@ -13,8 +13,8 @@ #include #include -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() { /* diff --git a/src/widgets/HexdumpWidget.h b/src/widgets/HexdumpWidget.h index a36aa0c7..c3202188 100644 --- a/src/widgets/HexdumpWidget.h +++ b/src/widgets/HexdumpWidget.h @@ -3,13 +3,13 @@ #include #include -#include #include #include #include #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; diff --git a/src/widgets/ImportsWidget.cpp b/src/widgets/ImportsWidget.cpp index b7130afe..79f9e905 100644 --- a/src/widgets/ImportsWidget.cpp +++ b/src/widgets/ImportsWidget.cpp @@ -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); diff --git a/src/widgets/ImportsWidget.h b/src/widgets/ImportsWidget.h index b3943a9c..363de9b2 100644 --- a/src/widgets/ImportsWidget.h +++ b/src/widgets/ImportsWidget.h @@ -3,10 +3,11 @@ #include -#include #include #include +#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; - MainWindow *main; void highlightUnsafe(); void setScrollMode(); diff --git a/src/widgets/JupyterWidget.cpp b/src/widgets/JupyterWidget.cpp index 8d6301ec..bdc8fe33 100644 --- a/src/widgets/JupyterWidget.cpp +++ b/src/widgets/JupyterWidget.cpp @@ -14,8 +14,8 @@ #include #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); diff --git a/src/widgets/JupyterWidget.h b/src/widgets/JupyterWidget.h index a689f8ef..da417414 100644 --- a/src/widgets/JupyterWidget.h +++ b/src/widgets/JupyterWidget.h @@ -6,9 +6,9 @@ #include -#include #include +#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 diff --git a/src/widgets/PseudocodeWidget.cpp b/src/widgets/PseudocodeWidget.cpp index 443787ef..b67f6aed 100644 --- a/src/widgets/PseudocodeWidget.cpp +++ b/src/widgets/PseudocodeWidget.cpp @@ -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() {} diff --git a/src/widgets/PseudocodeWidget.h b/src/widgets/PseudocodeWidget.h index f2830eaa..37843444 100644 --- a/src/widgets/PseudocodeWidget.h +++ b/src/widgets/PseudocodeWidget.h @@ -1,10 +1,10 @@ #ifndef PSEUDOCODEWIDGET_H #define PSEUDOCODEWIDGET_H -#include #include #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: diff --git a/src/widgets/RelocsWidget.cpp b/src/widgets/RelocsWidget.cpp index 6bec1a50..5c3bba49 100644 --- a/src/widgets/RelocsWidget.cpp +++ b/src/widgets/RelocsWidget.cpp @@ -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())); diff --git a/src/widgets/RelocsWidget.h b/src/widgets/RelocsWidget.h index 3d081f86..2aee1fdf 100644 --- a/src/widgets/RelocsWidget.h +++ b/src/widgets/RelocsWidget.h @@ -3,7 +3,7 @@ #include -#include +#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; - MainWindow *main; void setScrollMode(); }; diff --git a/src/widgets/ResourcesWidget.cpp b/src/widgets/ResourcesWidget.cpp index 7f751652..c07a1388 100644 --- a/src/widgets/ResourcesWidget.cpp +++ b/src/widgets/ResourcesWidget.cpp @@ -1,5 +1,6 @@ #include "utils/Helpers.h" #include "ResourcesWidget.h" +#include "MainWindow.h" #include ResourcesModel::ResourcesModel(QList *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"); diff --git a/src/widgets/ResourcesWidget.h b/src/widgets/ResourcesWidget.h index f20ddb99..a59ccdd5 100644 --- a/src/widgets/ResourcesWidget.h +++ b/src/widgets/ResourcesWidget.h @@ -2,11 +2,13 @@ #define RESOURCESWIDGET_H #include "Cutter.h" +#include "CutterDockWidget.h" -#include #include #include +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 resources; public: - ResourcesWidget(QWidget *parent = nullptr); + explicit ResourcesWidget(MainWindow *main, QAction *action = nullptr); private slots: void refreshResources(); diff --git a/src/widgets/SdbDock.cpp b/src/widgets/SdbDock.cpp index d1e441de..a0512e66 100644 --- a/src/widgets/SdbDock.cpp +++ b/src/widgets/SdbDock.cpp @@ -7,8 +7,8 @@ #include -SdbDock::SdbDock(QWidget *parent) : - QDockWidget(parent), +SdbDock::SdbDock(MainWindow *main, QAction *action) : + CutterDockWidget(main, action), ui(new Ui::SdbDock) { ui->setupUi(this); diff --git a/src/widgets/SdbDock.h b/src/widgets/SdbDock.h index 7cfaaaf3..e559fe09 100644 --- a/src/widgets/SdbDock.h +++ b/src/widgets/SdbDock.h @@ -3,7 +3,7 @@ #include -#include +#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: diff --git a/src/widgets/SearchWidget.cpp b/src/widgets/SearchWidget.cpp index e9e0b0d0..7c5c675b 100644 --- a/src/widgets/SearchWidget.cpp +++ b/src/widgets/SearchWidget.cpp @@ -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); diff --git a/src/widgets/SearchWidget.h b/src/widgets/SearchWidget.h index 8af8832b..fcc74fa5 100644 --- a/src/widgets/SearchWidget.h +++ b/src/widgets/SearchWidget.h @@ -5,9 +5,9 @@ #include #include -#include #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; - MainWindow *main; SearchModel *search_model; SearchSortFilterProxyModel *search_proxy_model; diff --git a/src/widgets/SectionsDock.cpp b/src/widgets/SectionsDock.cpp index 5adc756e..29605449 100644 --- a/src/widgets/SectionsDock.cpp +++ b/src/widgets/SectionsDock.cpp @@ -8,15 +8,13 @@ #include -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); diff --git a/src/widgets/SectionsDock.h b/src/widgets/SectionsDock.h index 59e2d4b3..702c45ba 100644 --- a/src/widgets/SectionsDock.h +++ b/src/widgets/SectionsDock.h @@ -3,7 +3,7 @@ #include -#include +#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: diff --git a/src/widgets/SidebarWidget.cpp b/src/widgets/SidebarWidget.cpp index f24f602d..806fc054 100644 --- a/src/widgets/SidebarWidget.cpp +++ b/src/widgets/SidebarWidget.cpp @@ -16,8 +16,8 @@ #include -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() { } diff --git a/src/widgets/SidebarWidget.h b/src/widgets/SidebarWidget.h index 2e77158b..a968c37d 100644 --- a/src/widgets/SidebarWidget.h +++ b/src/widgets/SidebarWidget.h @@ -5,14 +5,15 @@ #include #include -#include #include #include #include #include #include #include + #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: diff --git a/src/widgets/StringsWidget.cpp b/src/widgets/StringsWidget.cpp index 9d50cb65..7131e588 100644 --- a/src/widgets/StringsWidget.cpp +++ b/src/widgets/StringsWidget.cpp @@ -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); diff --git a/src/widgets/StringsWidget.h b/src/widgets/StringsWidget.h index 77d28ba5..f80c72eb 100644 --- a/src/widgets/StringsWidget.h +++ b/src/widgets/StringsWidget.h @@ -4,10 +4,10 @@ #include #include "Cutter.h" +#include "CutterDockWidget.h" #include #include -#include 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: diff --git a/src/widgets/SymbolsWidget.cpp b/src/widgets/SymbolsWidget.cpp index 2b0586ad..1fb8e740 100644 --- a/src/widgets/SymbolsWidget.cpp +++ b/src/widgets/SymbolsWidget.cpp @@ -7,8 +7,8 @@ #include -SymbolsWidget::SymbolsWidget(QWidget *parent) : - QDockWidget(parent), +SymbolsWidget::SymbolsWidget(MainWindow *main, QAction *action) : + CutterDockWidget(main, action), ui(new Ui::SymbolsWidget) { ui->setupUi(this); diff --git a/src/widgets/SymbolsWidget.h b/src/widgets/SymbolsWidget.h index 6110bc4c..8ed7a8c0 100644 --- a/src/widgets/SymbolsWidget.h +++ b/src/widgets/SymbolsWidget.h @@ -3,7 +3,7 @@ #include -#include +#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: diff --git a/src/widgets/TypesWidget.cpp b/src/widgets/TypesWidget.cpp index 211292cf..e403734f 100644 --- a/src/widgets/TypesWidget.cpp +++ b/src/widgets/TypesWidget.cpp @@ -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); diff --git a/src/widgets/TypesWidget.h b/src/widgets/TypesWidget.h index 4b73fca2..56b3d184 100644 --- a/src/widgets/TypesWidget.h +++ b/src/widgets/TypesWidget.h @@ -4,10 +4,10 @@ #include #include "Cutter.h" +#include "CutterDockWidget.h" #include #include -#include 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; - MainWindow *main; TypesModel *types_model; TypesSortFilterProxyModel *types_proxy_model; diff --git a/src/widgets/VTablesWidget.cpp b/src/widgets/VTablesWidget.cpp index ad6c8026..9a92ec36 100644 --- a/src/widgets/VTablesWidget.cpp +++ b/src/widgets/VTablesWidget.cpp @@ -1,6 +1,7 @@ #include #include +#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); diff --git a/src/widgets/VTablesWidget.h b/src/widgets/VTablesWidget.h index 7c727c7f..cfd314cc 100644 --- a/src/widgets/VTablesWidget.h +++ b/src/widgets/VTablesWidget.h @@ -5,15 +5,17 @@ #include #include -#include #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: