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
|
|
|
|
|
|
|
#include "cutter.h" // only needed for ut64
|
2017-10-12 19:55:15 +00:00
|
|
|
#include "widgets/DisassemblyWidget.h"
|
|
|
|
#include "widgets/SidebarWidget.h"
|
|
|
|
#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"
|
2017-10-14 09:35:49 +00:00
|
|
|
#include "utils/Configuration.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;
|
2017-10-12 19:55:15 +00:00
|
|
|
class PreviewWidget;
|
2017-04-13 15:36:20 +00:00
|
|
|
class Notepad;
|
|
|
|
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;
|
|
|
|
class SdbDock;
|
|
|
|
class QAction;
|
|
|
|
class SectionsDock;
|
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;
|
2017-04-13 15:36:20 +00:00
|
|
|
|
|
|
|
class QDockWidget;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-04-09 19:55:06 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainWindow;
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool responsive;
|
|
|
|
|
2017-05-13 18:09:36 +00:00
|
|
|
explicit MainWindow(QWidget *parent = 0);
|
2017-04-01 01:56:35 +00:00
|
|
|
~MainWindow();
|
|
|
|
|
2018-01-27 10:40:26 +00:00
|
|
|
void openNewFile(const QString &fn, int analLevel = -1, QList<QString> advancedOptions = QList<QString>());
|
2018-02-06 18:23:01 +00:00
|
|
|
void displayNewFileDialog();
|
2018-02-10 18:04:31 +00:00
|
|
|
void closeNewFileDialog();
|
2018-01-27 10:40:26 +00:00
|
|
|
void displayAnalysisOptionsDialog(int analLevel, QList<QString> advancedOptions);
|
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();
|
|
|
|
void finalizeOpen();
|
|
|
|
|
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
|
|
|
|
* @return if quit is true, false if the application should not close
|
|
|
|
*/
|
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();
|
2017-04-28 13:38:01 +00:00
|
|
|
void setFilename(const QString &fn);
|
2017-04-26 23:00:20 +00:00
|
|
|
void addOutput(const QString &msg);
|
|
|
|
void addDebugOutput(const QString &msg);
|
|
|
|
void sendToNotepad(const QString &txt);
|
2017-04-27 18:59:27 +00:00
|
|
|
void refreshOmniBar(const QStringList &flags);
|
2017-04-01 01:56:35 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
public slots:
|
|
|
|
|
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);
|
|
|
|
|
2017-09-02 08:46:48 +00:00
|
|
|
void backButton_clicked();
|
2017-04-05 09:35:19 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private slots:
|
|
|
|
void on_actionAbout_triggered();
|
|
|
|
|
|
|
|
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
|
|
|
|
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_actionForward_triggered();
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2017-10-21 19:20:10 +00:00
|
|
|
void projectSaved(const QString &name);
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private:
|
2018-02-04 14:32:18 +00:00
|
|
|
CutterCore *core;
|
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;
|
|
|
|
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
|
|
|
Notepad *notepadDock = nullptr;
|
|
|
|
DisassemblyWidget *disassemblyDock = nullptr;
|
|
|
|
SidebarWidget *sidebarDock = nullptr;
|
|
|
|
HexdumpWidget *hexdumpDock = nullptr;
|
|
|
|
PseudocodeWidget *pseudocodeDock = nullptr;
|
|
|
|
QDockWidget *graphDock = nullptr;
|
|
|
|
EntrypointWidget *entrypointDock = nullptr;
|
|
|
|
FunctionsWidget *functionsDock = nullptr;
|
|
|
|
ImportsWidget *importsDock = nullptr;
|
|
|
|
ExportsWidget *exportsDock = nullptr;
|
|
|
|
SymbolsWidget *symbolsDock = nullptr;
|
|
|
|
RelocsWidget *relocsDock = nullptr;
|
|
|
|
CommentsWidget *commentsDock = nullptr;
|
|
|
|
StringsWidget *stringsDock = nullptr;
|
|
|
|
FlagsWidget *flagsDock = nullptr;
|
|
|
|
Dashboard *dashboardDock = nullptr;
|
|
|
|
QLineEdit *gotoEntry = nullptr;
|
|
|
|
SdbDock *sdbDock = nullptr;
|
|
|
|
SectionsDock *sectionsDock = nullptr;
|
|
|
|
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-02-10 18:04:31 +00:00
|
|
|
NewFileDialog *newFileDialog = nullptr;
|
2017-12-21 15:47:36 +00:00
|
|
|
|
|
|
|
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
2017-05-19 07:45:26 +00:00
|
|
|
|
2017-11-03 17:22:54 +00:00
|
|
|
void resetToDefaultLayout();
|
|
|
|
|
|
|
|
void restoreDocks();
|
|
|
|
void hideAllDocks();
|
|
|
|
void showDefaultDocks();
|
2017-12-21 15:47:36 +00:00
|
|
|
void updateDockActionsChecked();
|
2017-11-03 17:22:54 +00:00
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
public:
|
2017-05-13 18:09:36 +00:00
|
|
|
QString getFilename() const { return filename; }
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|