-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWidget.h
184 lines (143 loc) · 3.85 KB
/
MainWidget.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include <QWidget>
#include <QSystemTrayIcon>
#include <QMenuBar>
#include <QVBoxLayout>
#include <QAction>
#include <QMouseEvent>
#include <QFileDialog>
#include <QDropEvent>
#include <QDragEnterEvent>
#include "FramelessWidget.h"
#include "TrayIconMenu.h"
#include "TitleBar.h"
#include "MiddleWidget.h"
#include "StatusBar.h"
#include "OptionDialog.h"
#include "SearchDialog.h"
#include "qhexedit.h"
#include "InfoFrame.h"
#include "GdbWidget.h"
#include "SerialWidget.h"
#include "GdbSetWidget.h"
#include "CheckFileThread.h"
//Bug List:
//1. the frameless window can't move out the real screen window {[Windows(N) Linux(Y)] system bug?(seem yes)}
//2. QFileDialog bug; [Error Msg](GtkDialog mapped without a transient parent. This is discouraged.) {[Windows(N) Linux(Y)] system bug?(seem yes)}
class MainWidget : public FramelessWidget
{
Q_OBJECT
public:
MainWidget(QWidget *parent = nullptr);
~MainWidget();
private:
//app window is max or normal
bool isMaximun;
bool quitTips;
//sys tray
QSystemTrayIcon *m_SystemTray;
TrayIconMenu *m_TrayMenu;
//main menuBar
QMenuBar *mainMenuBar;
//list menu
QMenu *fileMenu;
QMenu *editMenu;
QMenu *watchMenu;
QMenu *setMenu;
QMenu *helpMenu;
//for fileMenu
QAction *openAct;
QAction *saveAct;
QAction *saveAsAct;
QAction *saveReadable;
QAction *exitAct;
//for editMenu
QAction *undoAct;
QAction *redoAct;
QAction *saveSelectionReadable;
QAction *findNextAct;
QAction *findPreAct;
QAction *findAct;
QAction *optionsAct;
//for watchMenu
QAction *infoAct;
QAction *twolineAct;//斑马纹
//for setMenu
QAction *debugAct;
QAction *gdbWinAct;
QAction *serialWinAct;
//bytes to kb...
QString humanReadableSize(const qint64 &size, int precision);//change byte kb mb
//for helpMenu
QAction *aboutAct;
//TitleBar
TitleBar *mainTitleBar;
InfoFrame *infoWidget;
QFrame *leftFrame;
//middleWidget
MiddleWidget *mainMiddleWidget;
//StatusBar
StatusBar *mainStatusBar;
//set dialog
OptionDialog *optionDialog;
SearchDialog *searchDialog;
GdbWidget *gdbWidget;
SerialWidget *serialWidget;
GdbSetWidget *gdbSetWidget;
void initSystemTray();
void initOtherWidget();
void initMenu();
void initAction();
void initLayout();
//init all;
void init();
void getFileInfo();//get current file info;
CheckFileThread *check_thread;
protected:
void mousePressEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
private:
void writeSettings();
void readSettings();
private:
void openFile();
public:
void loadFile(const QString& fileName);
private:
void setTitleFileName(const QString fileName);
bool save();
bool saveAs();
bool saveFile(const QString& filename);
void saveToReadableFile();
void saveSelectionToReadableFile();
void setOverwriteMode(bool mode);
void dataChanged();
void showOptionDialog();
void showSearchDialog();
void showGdbSetDialog();
void showGdbDialog();
void showserialDialog();
void checkDumpFile(QString dumpfilename);
private slots:
void findNext();
void findPre();
void TrayActivated(QSystemTrayIcon::ActivationReason);
public slots:
void optionAccept();
void removeSubTab(int index);
void recv_info(QString GdbPath, QString Host, QString Port);
private:
QString strippedName(const QString &fullFileName);
QStringList file_list;
QString gdb_path;
QString gdb_path_pre;
QString hostname;
QString portnum;
public:
void openDum(QString str);
};
#endif // MAINWIDGET_H