2017-03-29 10:18:37 +00:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2017-10-02 09:41:28 +00:00
|
|
|
#include <memory>
|
2017-10-22 10:21:44 +00:00
|
|
|
|
2018-03-04 17:42:02 +00:00
|
|
|
#include "Cutter.h" // only needed for ut64
|
2017-10-12 19:55:15 +00:00
|
|
|
#include "widgets/DisassemblyWidget.h"
|
2019-01-24 17:13:04 +00:00
|
|
|
#include "widgets/GraphWidget.h"
|
|
|
|
#include "widgets/OverviewWidget.h"
|
2018-06-06 11:05:20 +00:00
|
|
|
#include "widgets/StackWidget.h"
|
|
|
|
#include "widgets/RegistersWidget.h"
|
|
|
|
#include "widgets/BacktraceWidget.h"
|
2017-10-12 19:55:15 +00:00
|
|
|
#include "widgets/HexdumpWidget.h"
|
2017-12-06 23:19:14 +00:00
|
|
|
#include "widgets/PseudocodeWidget.h"
|
2018-02-10 18:04:31 +00:00
|
|
|
#include "dialogs/NewFileDialog.h"
|
2019-01-19 20:54:02 +00:00
|
|
|
#include "dialogs/WelcomeDialog.h"
|
2018-10-17 07:55:53 +00:00
|
|
|
#include "common/Configuration.h"
|
|
|
|
#include "common/InitialOptions.h"
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-10-22 10:21:44 +00:00
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QList>
|
|
|
|
|
2017-09-25 12:55:41 +00:00
|
|
|
class CutterCore;
|
2017-04-13 15:36:20 +00:00
|
|
|
class Omnibar;
|
2018-06-24 19:12:02 +00:00
|
|
|
class ProgressIndicator;
|
2017-10-12 19:55:15 +00:00
|
|
|
class PreviewWidget;
|
2017-04-13 15:36:20 +00:00
|
|
|
class Highlighter;
|
|
|
|
class AsciiHighlighter;
|
2017-12-08 15:00:52 +00:00
|
|
|
class VisualNavbar;
|
2017-04-13 15:36:20 +00:00
|
|
|
class FunctionsWidget;
|
|
|
|
class ImportsWidget;
|
2017-05-19 07:45:26 +00:00
|
|
|
class ExportsWidget;
|
2017-04-13 15:36:20 +00:00
|
|
|
class SymbolsWidget;
|
|
|
|
class RelocsWidget;
|
|
|
|
class CommentsWidget;
|
|
|
|
class StringsWidget;
|
|
|
|
class FlagsWidget;
|
|
|
|
class Dashboard;
|
|
|
|
class QLineEdit;
|
2019-02-13 06:38:47 +00:00
|
|
|
class SdbWidget;
|
2017-04-13 15:36:20 +00:00
|
|
|
class QAction;
|
2018-05-03 07:52:30 +00:00
|
|
|
class SectionsWidget;
|
2018-10-20 18:20:06 +00:00
|
|
|
class SegmentsWidget;
|
2017-04-26 23:00:20 +00:00
|
|
|
class ConsoleWidget;
|
2017-07-13 18:49:12 +00:00
|
|
|
class EntrypointWidget;
|
2017-10-22 10:21:44 +00:00
|
|
|
class DisassemblerGraphView;
|
2017-12-23 16:42:42 +00:00
|
|
|
class ClassesWidget;
|
2018-02-04 14:32:18 +00:00
|
|
|
class ResourcesWidget;
|
2018-02-26 22:26:18 +00:00
|
|
|
class VTablesWidget;
|
2018-03-06 17:21:48 +00:00
|
|
|
class TypesWidget;
|
2018-05-21 17:34:41 +00:00
|
|
|
class HeadersWidget;
|
2018-05-24 15:37:37 +00:00
|
|
|
class ZignaturesWidget;
|
2018-03-08 12:24:15 +00:00
|
|
|
class SearchWidget;
|
2018-03-02 13:15:53 +00:00
|
|
|
#ifdef CUTTER_ENABLE_JUPYTER
|
2017-12-13 17:36:00 +00:00
|
|
|
class JupyterWidget;
|
2018-03-02 13:15:53 +00:00
|
|
|
#endif
|
2017-04-13 15:36:20 +00:00
|
|
|
class QDockWidget;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool responsive;
|
|
|
|
|
2018-05-04 07:58:32 +00:00
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
2018-09-30 20:00:44 +00:00
|
|
|
~MainWindow() override;
|
2017-04-01 01:56:35 +00:00
|
|
|
|
2018-08-18 16:04:45 +00:00
|
|
|
void openNewFile(InitialOptions options = InitialOptions(), bool skipOptionsDialog = false);
|
2018-02-06 18:23:01 +00:00
|
|
|
void displayNewFileDialog();
|
2019-01-19 20:54:02 +00:00
|
|
|
void displayWelcomeDialog();
|
2018-02-10 18:04:31 +00:00
|
|
|
void closeNewFileDialog();
|
2017-11-03 17:22:54 +00:00
|
|
|
void openProject(const QString &project_name);
|
2017-10-21 19:20:10 +00:00
|
|
|
|
2017-05-13 18:09:36 +00:00
|
|
|
void initUI();
|
|
|
|
|
2017-10-21 19:20:10 +00:00
|
|
|
/*!
|
|
|
|
* @param quit whether to show destructive button in dialog
|
|
|
|
* @return if quit is true, false if the application should not close
|
|
|
|
*/
|
|
|
|
bool saveProject(bool quit = false);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @param quit whether to show destructive button in dialog
|
2018-10-12 07:08:04 +00:00
|
|
|
* @return false if the application should not close
|
2017-10-21 19:20:10 +00:00
|
|
|
*/
|
2017-11-03 17:22:54 +00:00
|
|
|
bool saveProjectAs(bool quit = false);
|
2017-05-13 18:09:36 +00:00
|
|
|
|
2017-10-12 19:55:15 +00:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2017-03-29 10:18:37 +00:00
|
|
|
void readSettings();
|
2017-12-17 13:49:03 +00:00
|
|
|
void saveSettings();
|
2018-07-23 23:12:36 +00:00
|
|
|
void readDebugSettings();
|
|
|
|
void saveDebugSettings();
|
2017-04-28 13:38:01 +00:00
|
|
|
void setFilename(const QString &fn);
|
2017-04-27 18:59:27 +00:00
|
|
|
void refreshOmniBar(const QStringList &flags);
|
2017-04-01 01:56:35 +00:00
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
void addToDockWidgetList(QDockWidget *dockWidget);
|
|
|
|
void addDockWidgetAction(QDockWidget *dockWidget, QAction *action);
|
2018-05-25 14:30:59 +00:00
|
|
|
void addExtraWidget(QDockWidget *extraDock);
|
|
|
|
|
2018-10-16 06:25:09 +00:00
|
|
|
void updateDockActionChecked(QAction * action);
|
|
|
|
|
2019-02-19 15:56:50 +00:00
|
|
|
QString getFilename() const
|
|
|
|
{
|
|
|
|
return filename;
|
|
|
|
}
|
2018-03-16 21:46:57 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
public slots:
|
2018-05-27 16:03:29 +00:00
|
|
|
void finalizeOpen();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-11-19 12:56:10 +00:00
|
|
|
void refreshAll();
|
|
|
|
|
2017-12-17 13:49:03 +00:00
|
|
|
void setPanelLock();
|
|
|
|
void setTabLocation();
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
void on_actionLock_triggered();
|
|
|
|
|
|
|
|
void on_actionLockUnlock_triggered();
|
|
|
|
|
|
|
|
void on_actionTabs_triggered();
|
|
|
|
|
|
|
|
void lockUnlock_Docks(bool what);
|
|
|
|
|
|
|
|
void on_actionRun_Script_triggered();
|
|
|
|
|
|
|
|
void toggleResponsive(bool maybe);
|
|
|
|
|
2018-05-08 20:44:53 +00:00
|
|
|
void openNewFileFailed();
|
|
|
|
|
2019-02-19 15:56:50 +00:00
|
|
|
void toggleOverview(bool visibility, GraphWidget *targetGraph);
|
|
|
|
void adjustOverview();
|
|
|
|
void adjustGraph();
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private slots:
|
|
|
|
void on_actionAbout_triggered();
|
2019-02-07 10:52:08 +00:00
|
|
|
void on_actionIssue_triggered();
|
2018-05-25 14:30:59 +00:00
|
|
|
void on_actionExtraGraph_triggered();
|
|
|
|
void on_actionExtraHexdump_triggered();
|
|
|
|
void on_actionExtraDisassembly_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
void on_actionRefresh_Panels_triggered();
|
|
|
|
|
|
|
|
void on_actionDisasAdd_comment_triggered();
|
|
|
|
|
2018-01-16 14:09:51 +00:00
|
|
|
void on_actionDefault_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
void on_actionFunctionsRename_triggered();
|
|
|
|
|
|
|
|
void on_actionNew_triggered();
|
|
|
|
|
|
|
|
void on_actionSave_triggered();
|
2017-11-03 17:22:54 +00:00
|
|
|
void on_actionSaveAs_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-03-08 09:11:19 +00:00
|
|
|
void on_actionBackward_triggered();
|
|
|
|
void on_actionForward_triggered();
|
2017-11-27 17:28:44 +00:00
|
|
|
void on_actionUndoSeek_triggered();
|
|
|
|
void on_actionRedoSeek_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-01-16 14:09:51 +00:00
|
|
|
void on_actionOpen_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
void on_actionTabs_on_Top_triggered();
|
|
|
|
|
|
|
|
void on_actionReset_settings_triggered();
|
|
|
|
|
2017-03-31 21:54:06 +00:00
|
|
|
void on_actionQuit_triggered();
|
|
|
|
|
2017-05-26 08:52:17 +00:00
|
|
|
void on_actionRefresh_contents_triggered();
|
2017-04-12 21:04:39 +00:00
|
|
|
|
2017-12-14 13:42:24 +00:00
|
|
|
void on_actionPreferences_triggered();
|
2017-09-02 08:17:48 +00:00
|
|
|
|
2018-01-27 10:40:26 +00:00
|
|
|
void on_actionAnalyze_triggered();
|
|
|
|
|
2018-01-16 14:09:51 +00:00
|
|
|
void on_actionImportPDB_triggered();
|
|
|
|
|
2018-08-24 22:36:15 +00:00
|
|
|
void on_actionExport_as_code_triggered();
|
|
|
|
|
2018-11-02 06:48:17 +00:00
|
|
|
void projectSaved(bool successfully, const QString &name);
|
2017-10-21 19:20:10 +00:00
|
|
|
|
2018-06-22 18:34:25 +00:00
|
|
|
void updateTasksIndicator();
|
|
|
|
|
2018-05-13 07:50:01 +00:00
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
2018-09-30 20:00:44 +00:00
|
|
|
bool eventFilter(QObject *object, QEvent *event) override;
|
2018-06-12 15:42:38 +00:00
|
|
|
void changeDebugView();
|
|
|
|
void changeDefinedView();
|
2018-05-13 07:50:01 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private:
|
2018-02-04 14:32:18 +00:00
|
|
|
CutterCore *core;
|
2017-12-13 17:36:00 +00:00
|
|
|
|
2017-12-17 13:49:03 +00:00
|
|
|
bool panelLock;
|
|
|
|
bool tabsOnTop;
|
2017-03-29 10:18:37 +00:00
|
|
|
ut64 hexdumpTopOffset;
|
|
|
|
ut64 hexdumpBottomOffset;
|
|
|
|
QString filename;
|
2017-10-02 09:41:28 +00:00
|
|
|
std::unique_ptr<Ui::MainWindow> ui;
|
2018-02-04 14:32:18 +00:00
|
|
|
Highlighter *highlighter;
|
2017-03-29 10:18:37 +00:00
|
|
|
AsciiHighlighter *hex_highlighter;
|
2018-02-04 14:32:18 +00:00
|
|
|
VisualNavbar *visualNavbar;
|
|
|
|
Omnibar *omnibar;
|
2018-06-24 19:12:02 +00:00
|
|
|
ProgressIndicator *tasksProgressIndicator;
|
2018-06-22 18:34:25 +00:00
|
|
|
|
2018-02-04 14:32:18 +00:00
|
|
|
Configuration *configuration;
|
2017-04-28 13:09:40 +00:00
|
|
|
|
2017-12-21 15:47:36 +00:00
|
|
|
QList<QDockWidget *> dockWidgets;
|
|
|
|
QMap<QAction *, QDockWidget *> dockWidgetActions;
|
2018-02-04 14:32:18 +00:00
|
|
|
DisassemblyWidget *disassemblyDock = nullptr;
|
|
|
|
HexdumpWidget *hexdumpDock = nullptr;
|
|
|
|
PseudocodeWidget *pseudocodeDock = nullptr;
|
2019-01-24 17:13:04 +00:00
|
|
|
GraphWidget *graphDock = nullptr;
|
2019-02-19 15:56:50 +00:00
|
|
|
GraphWidget *targetGraphDock = nullptr;
|
|
|
|
OverviewWidget *overviewDock = nullptr;
|
2018-02-04 14:32:18 +00:00
|
|
|
EntrypointWidget *entrypointDock = nullptr;
|
|
|
|
FunctionsWidget *functionsDock = nullptr;
|
|
|
|
ImportsWidget *importsDock = nullptr;
|
|
|
|
ExportsWidget *exportsDock = nullptr;
|
2018-05-21 17:34:41 +00:00
|
|
|
HeadersWidget *headersDock = nullptr;
|
2018-03-06 17:21:48 +00:00
|
|
|
TypesWidget *typesDock = nullptr;
|
2018-05-21 17:34:41 +00:00
|
|
|
SearchWidget *searchDock = nullptr;
|
2018-02-04 14:32:18 +00:00
|
|
|
SymbolsWidget *symbolsDock = nullptr;
|
|
|
|
RelocsWidget *relocsDock = nullptr;
|
|
|
|
CommentsWidget *commentsDock = nullptr;
|
|
|
|
StringsWidget *stringsDock = nullptr;
|
|
|
|
FlagsWidget *flagsDock = nullptr;
|
|
|
|
Dashboard *dashboardDock = nullptr;
|
|
|
|
QLineEdit *gotoEntry = nullptr;
|
2019-02-13 06:38:47 +00:00
|
|
|
SdbWidget *sdbDock = nullptr;
|
2018-05-03 07:52:30 +00:00
|
|
|
SectionsWidget *sectionsDock = nullptr;
|
2018-10-20 18:20:06 +00:00
|
|
|
SegmentsWidget *segmentsDock = nullptr;
|
2018-05-24 15:37:37 +00:00
|
|
|
ZignaturesWidget *zignaturesDock = nullptr;
|
2018-02-04 14:32:18 +00:00
|
|
|
ConsoleWidget *consoleDock = nullptr;
|
|
|
|
ClassesWidget *classesDock = nullptr;
|
|
|
|
ResourcesWidget *resourcesDock = nullptr;
|
2018-02-26 22:26:18 +00:00
|
|
|
VTablesWidget *vTablesDock = nullptr;
|
2018-02-04 14:32:18 +00:00
|
|
|
DisassemblerGraphView *graphView = nullptr;
|
|
|
|
QDockWidget *asmDock = nullptr;
|
|
|
|
QDockWidget *calcDock = nullptr;
|
2018-06-06 11:05:20 +00:00
|
|
|
QDockWidget *stackDock = nullptr;
|
|
|
|
QDockWidget *registersDock = nullptr;
|
|
|
|
QDockWidget *backtraceDock = nullptr;
|
2018-06-12 08:43:14 +00:00
|
|
|
QDockWidget *memoryMapDock = nullptr;
|
2017-12-13 17:36:00 +00:00
|
|
|
NewFileDialog *newFileDialog = nullptr;
|
2018-06-22 08:45:00 +00:00
|
|
|
QDockWidget *breakpointDock = nullptr;
|
2018-07-19 14:35:46 +00:00
|
|
|
QDockWidget *registerRefsDock = nullptr;
|
2018-03-02 13:15:53 +00:00
|
|
|
#ifdef CUTTER_ENABLE_JUPYTER
|
2017-12-13 17:36:00 +00:00
|
|
|
JupyterWidget *jupyterDock = nullptr;
|
2018-03-02 13:15:53 +00:00
|
|
|
#endif
|
2017-12-21 15:47:36 +00:00
|
|
|
|
2018-08-18 16:04:45 +00:00
|
|
|
void displayInitialOptionsDialog(const InitialOptions &options = InitialOptions(), bool skipOptionsDialog = false);
|
|
|
|
|
2017-11-03 17:22:54 +00:00
|
|
|
void resetToDefaultLayout();
|
2018-06-12 15:42:38 +00:00
|
|
|
void resetToDebugLayout();
|
2019-01-14 08:17:10 +00:00
|
|
|
void restoreDebugLayout();
|
2017-11-03 17:22:54 +00:00
|
|
|
|
|
|
|
void restoreDocks();
|
|
|
|
void hideAllDocks();
|
2018-05-25 14:30:59 +00:00
|
|
|
void showZenDocks();
|
2018-06-12 15:42:38 +00:00
|
|
|
void showDebugDocks();
|
2018-10-22 18:06:30 +00:00
|
|
|
void enableDebugWidgetsMenu(bool enable);
|
2017-11-03 17:22:54 +00:00
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
|
|
|
|
2018-10-16 06:25:09 +00:00
|
|
|
void updateDockActionsChecked();
|
2019-02-19 15:56:50 +00:00
|
|
|
void setOverviewData();
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|