cutter/src/MainWindow.h

215 lines
5.4 KiB
C
Raw Normal View History

#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
#include "widgets/DisassemblyWidget.h"
#include "widgets/SidebarWidget.h"
#include "widgets/HexdumpWidget.h"
#include "widgets/PseudocodeWidget.h"
#include "dialogs/NewFileDialog.h"
#include "utils/Configuration.h"
2017-10-22 10:21:44 +00:00
#include <QMainWindow>
#include <QList>
2017-09-25 12:55:41 +00:00
class CutterCore;
class Omnibar;
class PreviewWidget;
class Highlighter;
class AsciiHighlighter;
class VisualNavbar;
class FunctionsWidget;
class ImportsWidget;
class ExportsWidget;
class SymbolsWidget;
class RelocsWidget;
class CommentsWidget;
class StringsWidget;
class FlagsWidget;
class Dashboard;
class QLineEdit;
class SdbDock;
class QAction;
class SectionsDock;
class ConsoleWidget;
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-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
class QDockWidget;
2017-04-09 19:55:06 +00:00
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
bool responsive;
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void openNewFile(const QString &fn, int analLevel = -1, QList<QString> advancedOptions = QList<QString>());
void displayNewFileDialog();
void closeNewFileDialog();
void displayAnalysisOptionsDialog(int analLevel, QList<QString> advancedOptions);
void openProject(const QString &project_name);
void initUI();
void finalizeOpen();
/*!
* @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
*/
bool saveProjectAs(bool quit = false);
void closeEvent(QCloseEvent *event) override;
void readSettings();
void saveSettings();
void setFilename(const QString &fn);
void addOutput(const QString &msg);
void addDebugOutput(const QString &msg);
void refreshOmniBar(const QStringList &flags);
public slots:
void refreshAll();
void setPanelLock();
void setTabLocation();
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
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();
void on_actionFunctionsRename_triggered();
void on_actionNew_triggered();
void on_actionSave_triggered();
void on_actionSaveAs_triggered();
2017-11-27 17:28:44 +00:00
void on_actionUndoSeek_triggered();
void on_actionRedoSeek_triggered();
2018-01-16 14:09:51 +00:00
void on_actionOpen_triggered();
void on_actionForward_triggered();
void on_actionTabs_on_Top_triggered();
void on_actionReset_settings_triggered();
void on_actionQuit_triggered();
void on_actionRefresh_contents_triggered();
void on_actionPreferences_triggered();
2017-09-02 08:17:48 +00:00
void on_actionAnalyze_triggered();
2018-01-16 14:09:51 +00:00
void on_actionImportPDB_triggered();
void projectSaved(const QString &name);
private:
2018-02-04 14:32:18 +00:00
CutterCore *core;
2017-12-13 17:36:00 +00:00
bool panelLock;
bool tabsOnTop;
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;
AsciiHighlighter *hex_highlighter;
2018-02-04 14:32:18 +00:00
VisualNavbar *visualNavbar;
Omnibar *omnibar;
Configuration *configuration;
QList<QDockWidget *> dockWidgets;
QMap<QAction *, QDockWidget *> dockWidgetActions;
2018-02-04 14:32:18 +00:00
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;
2018-03-06 17:21:48 +00:00
TypesWidget *typesDock = 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;
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;
2017-12-13 17:36:00 +00:00
NewFileDialog *newFileDialog = 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
void toggleDockWidget(QDockWidget *dock_widget, bool show);
void resetToDefaultLayout();
void restoreDocks();
void hideAllDocks();
void showDefaultDocks();
void updateDockActionsChecked();
public:
QString getFilename() const { return filename; }
};
#endif // MAINWINDOW_H