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"
|
2017-10-22 10:21:44 +00:00
|
|
|
#include "widgets/DisassemblerGraphView.h"
|
2017-10-12 19:55:15 +00:00
|
|
|
#include "widgets/SidebarWidget.h"
|
|
|
|
#include "widgets/HexdumpWidget.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 DockWidget;
|
|
|
|
class Omnibar;
|
2017-10-12 19:55:15 +00:00
|
|
|
class PreviewWidget;
|
2017-04-13 15:36:20 +00:00
|
|
|
class Notepad;
|
|
|
|
class SideBar;
|
|
|
|
class Highlighter;
|
|
|
|
class AsciiHighlighter;
|
|
|
|
class GraphicsBar;
|
|
|
|
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-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();
|
|
|
|
|
2017-10-21 19:20:10 +00:00
|
|
|
void openNewFile(const QString &fn, int anal_level = -1, QList<QString> advanced = QList<QString>());
|
|
|
|
void openProject(const QString &project_name);
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
bool saveProjectAs(bool quit = false);
|
2017-05-13 18:09:36 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
void start_web_server();
|
2017-10-12 19:55:15 +00:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2017-03-29 10:18:37 +00:00
|
|
|
void readSettings();
|
2017-04-28 13:38:01 +00:00
|
|
|
void setFilename(const QString &fn);
|
2017-03-29 10:18:37 +00:00
|
|
|
void updateFrames();
|
|
|
|
void refreshFunctions();
|
|
|
|
void refreshComments();
|
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-13 15:36:20 +00:00
|
|
|
void toggleSideBarTheme();
|
2017-04-27 18:59:27 +00:00
|
|
|
void refreshOmniBar(const QStringList &flags);
|
2017-04-01 01:56:35 +00:00
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
signals:
|
2017-10-09 18:08:35 +00:00
|
|
|
void cursorAddressChanged(RVA offset); // TODO cursor should be handled by its own widget
|
2017-04-28 13:09:40 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void dark();
|
|
|
|
|
|
|
|
void def_theme();
|
|
|
|
|
2017-07-13 18:49:12 +00:00
|
|
|
void on_actionEntry_points_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
void on_actionFunctions_triggered();
|
|
|
|
void on_actionImports_triggered();
|
2017-05-19 07:45:26 +00:00
|
|
|
void on_actionExports_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
void on_actionSymbols_triggered();
|
|
|
|
void on_actionReloc_triggered();
|
|
|
|
void on_actionStrings_triggered();
|
|
|
|
void on_actionSections_triggered();
|
|
|
|
void on_actionFlags_triggered();
|
|
|
|
void on_actionComents_triggered();
|
|
|
|
void on_actionNotepad_triggered();
|
|
|
|
|
|
|
|
void on_actionLock_triggered();
|
|
|
|
|
|
|
|
void on_actionLockUnlock_triggered();
|
|
|
|
|
|
|
|
void on_actionTabs_triggered();
|
|
|
|
|
|
|
|
void on_actionhide_bottomPannel_triggered();
|
|
|
|
|
|
|
|
void lockUnlock_Docks(bool what);
|
|
|
|
|
|
|
|
void on_actionDashboard_triggered();
|
|
|
|
|
|
|
|
void on_actionDark_Theme_triggered();
|
|
|
|
|
|
|
|
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-05-26 08:52:17 +00:00
|
|
|
void refreshVisibleDockWidgets();
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void on_actionMem_triggered();
|
|
|
|
|
|
|
|
void on_actionAbout_triggered();
|
|
|
|
|
|
|
|
void on_actionRefresh_Panels_triggered();
|
|
|
|
|
|
|
|
void on_actionCalculator_triggered();
|
|
|
|
|
|
|
|
void on_actionCreate_File_triggered();
|
|
|
|
|
|
|
|
void on_actionAssembler_triggered();
|
|
|
|
|
|
|
|
void on_actionDisasAdd_comment_triggered();
|
|
|
|
|
|
|
|
void restoreDocks();
|
|
|
|
|
|
|
|
void on_actionDefaut_triggered();
|
|
|
|
|
|
|
|
void hideAllDocks();
|
|
|
|
|
|
|
|
void showDefaultDocks();
|
|
|
|
|
|
|
|
void on_actionFunctionsRename_triggered();
|
|
|
|
|
|
|
|
void on_actionNew_triggered();
|
|
|
|
|
|
|
|
void on_actionSave_triggered();
|
2017-10-21 19:20:10 +00:00
|
|
|
void on_actionSaveAs_triggered();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
void on_actionWhite_Theme_triggered();
|
|
|
|
|
|
|
|
void on_actionSDB_browser_triggered();
|
|
|
|
|
|
|
|
void on_actionLoad_triggered();
|
|
|
|
|
|
|
|
void on_actionShow_Hide_mainsidebar_triggered();
|
|
|
|
|
|
|
|
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-10-01 14:36:40 +00:00
|
|
|
void on_actionAsmOptions_triggered();
|
2017-09-02 08:17:48 +00:00
|
|
|
|
2017-10-21 19:20:10 +00:00
|
|
|
void projectSaved(const QString &name);
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private:
|
2017-10-09 18:08:35 +00:00
|
|
|
CutterCore *core;
|
2017-10-12 19:55:15 +00:00
|
|
|
DisassemblyWidget *disassemblyDock;
|
|
|
|
SidebarWidget *sidebarDock;
|
|
|
|
HexdumpWidget *hexdumpDock;
|
2017-10-11 11:22:30 +00:00
|
|
|
QDockWidget *graphDock;
|
2017-10-22 10:21:44 +00:00
|
|
|
DisassemblerGraphView *graphView;
|
2017-04-13 15:36:20 +00:00
|
|
|
QDockWidget *asmDock;
|
|
|
|
QDockWidget *calcDock;
|
|
|
|
Omnibar *omnibar;
|
|
|
|
SideBar *sideBar;
|
2017-10-12 19:55:15 +00:00
|
|
|
PreviewWidget *previewDock;
|
2017-10-09 18:08:35 +00:00
|
|
|
Notepad *notepadDock;
|
2017-10-14 09:35:49 +00:00
|
|
|
Configuration *configuration;
|
2017-04-13 15:36:20 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
bool doLock;
|
2017-04-28 13:09:40 +00:00
|
|
|
void refreshMem();
|
2017-03-29 10:18:37 +00:00
|
|
|
ut64 hexdumpTopOffset;
|
|
|
|
ut64 hexdumpBottomOffset;
|
2017-10-03 18:38:34 +00:00
|
|
|
RVA cursorAddress;
|
2017-03-29 10:18:37 +00:00
|
|
|
QString filename;
|
2017-10-11 11:22:30 +00:00
|
|
|
QList<QDockWidget *> dockWidgets;
|
2017-10-02 09:41:28 +00:00
|
|
|
std::unique_ptr<Ui::MainWindow> ui;
|
2017-03-29 10:18:37 +00:00
|
|
|
Highlighter *highlighter;
|
|
|
|
AsciiHighlighter *hex_highlighter;
|
|
|
|
GraphicsBar *graphicsBar;
|
2017-07-13 18:49:12 +00:00
|
|
|
EntrypointWidget *entrypointDock;
|
2017-03-29 10:18:37 +00:00
|
|
|
FunctionsWidget *functionsDock;
|
|
|
|
ImportsWidget *importsDock;
|
2017-05-19 07:45:26 +00:00
|
|
|
ExportsWidget *exportsDock;
|
2017-03-29 10:18:37 +00:00
|
|
|
SymbolsWidget *symbolsDock;
|
|
|
|
RelocsWidget *relocsDock;
|
|
|
|
CommentsWidget *commentsDock;
|
|
|
|
StringsWidget *stringsDock;
|
|
|
|
FlagsWidget *flagsDock;
|
|
|
|
Dashboard *dashboardDock;
|
|
|
|
QLineEdit *gotoEntry;
|
|
|
|
SdbDock *sdbDock;
|
|
|
|
QAction *sidebar_action;
|
2017-04-12 10:16:43 +00:00
|
|
|
SectionsDock *sectionsDock;
|
2017-04-26 23:00:20 +00:00
|
|
|
ConsoleWidget *consoleWidget;
|
2017-04-28 13:09:40 +00:00
|
|
|
|
2017-10-21 19:20:10 +00:00
|
|
|
void toggleDockWidget(QDockWidget *dock_widget);
|
2017-05-19 07:45:26 +00:00
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
public:
|
2017-10-03 18:38:34 +00:00
|
|
|
RVA getCursorAddress() const { return cursorAddress; }
|
2017-05-13 18:09:36 +00:00
|
|
|
QString getFilename() const { return filename; }
|
2017-10-03 18:38:34 +00:00
|
|
|
void setCursorAddress(RVA addr);
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|