-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
127 lines (104 loc) · 2.5 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "qhexedit.h"
#include "optionsdialog.h"
#include "searchdialog.h"
#include "parserdialog.h"
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QUndoStack;
class QLabel;
class QDragEnterEvent;
class QDropEvent;
QT_END_NAMESPACE
// Forward declarations
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
~MainWindow();
Ui::MainWindow* _ui;
protected:
void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
signals:
void newFileLoaded();
private slots:
void about();
void dataChanged();
void open();
void optionsAccepted();
void findNext();
bool save();
bool saveAs();
void saveSelectionToReadableFile();
void saveToReadableFile();
void setAddress(qint64 address);
void setOverwriteMode(bool mode);
void setSize(qint64 size);
void showOptionsDialog();
void showSearchDialog();
void showParserDialog();
void showParserWindow();
private:
void init();
void createActions();
void createMenus();
void createStatusBar();
void createToolBars();
void loadFile(const QString &fileName);
void readSettings();
bool saveFile(const QString &fileName);
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
void writeSettings();
void emitNewFileLoaded();
// Members
QString curFile;
QFile file;
bool isUntitled;
QHexEdit *_hexEdit;
// Menus
QMenu *fileMenu;
QMenu *editMenu;
QMenu *viewMenu;
QMenu *helpMenu;
// Toolbars
QToolBar *fileToolBar;
QToolBar *editToolBar;
QToolBar *_parserToolBar;
// Actions
QAction *openAct;
QAction *saveAct;
QAction *saveAsAct;
QAction *saveReadable;
QAction *closeAct;
QAction *exitAct;
QAction *undoAct;
QAction *redoAct;
QAction *saveSelectionReadable;
QAction *aboutAct;
QAction *aboutQtAct;
QAction *optionsAct;
QAction *findAct;
QAction *findNextAct;
QAction *showParserWinAct;
QAction *_parserAct;
// Widgets
OptionsDialog *_optionsDialog;
ParserDialog *_parserDialog;
SearchDialog *_searchDialog;
QLabel *lbAddress, *lbAddressName;
QLabel *lbOverwriteMode, *lbOverwriteModeName;
QLabel *lbSize, *lbSizeName;
QDockWidget *_parserDockWidget;
QString _fileName;
};
#endif