-
Notifications
You must be signed in to change notification settings - Fork 41
/
mainwindow.h
404 lines (289 loc) · 9.51 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QCompleter>
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
#include <QDropEvent>
#include <QElapsedTimer>
#include <QFileDialog>
#include <QFileInfo>
#include <QFontDialog>
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QListWidgetItem>
#include <QMainWindow>
#include <QMimeData>
#include <QPalette>
#include <QProcess>
#include <QPushButton>
#include <QScreen>
#include <QScrollBar>
#include <QSortFilterProxyModel>
#include <QSplitter>
#include <QStandardItemModel>
#include <QTableWidget>
#include <QTextBlock>
#include <QTreeView>
#include <QUndoGroup>
//网络相关头文件
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkRequest>
// JSON相关头文件
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include "autoupdatedialog.h"
#include "codeeditor.h"
#include "domparser.h"
#include "editortabswidget.h"
#include "myhighlighter.h"
#include "recentfiles.h"
namespace Ui {
class MainWindow;
}
class ClickableLabel : public QLabel {
Q_OBJECT
public:
explicit ClickableLabel(const QString& text = "", QWidget* parent = 0);
~ClickableLabel();
signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent* event);
};
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
Ui::MainWindow* ui;
bool blListItemClick = false;
QLabel* lblShowFind;
bool isNULL = false;
bool mac = false;
bool win = false;
bool linuxOS = false;
AutoUpdateDialog* dlgAutoUpdate;
QLabel* lblStaInfo0;
QLabel* lblStaInfo1;
QLabel* lblStaInfo2;
QStringList reLoadByModiList;
QFont font;
bool findTextChanged = false;
CodeEditor* plistTextEditor;
bool osx1012 = false;
bool pasteBW = false;
QString strModiFile;
bool blAutoCheckUpdate = false;
void addWatchFiles();
void removeWatchFiles();
void AddACPI(QString fileStr);
void addKexts(QStringList FileName);
void init_enabled_data(QTableWidget* table, int row, int column, QString str);
void initKextTable(int row, QTableWidget* w);
void AddUEFIDrivers(QString fileStr);
void AddMiscTools(QString fileStr, QString fileStrBaseName);
void setItem(QModelIndex parentIndex, int row, QString key, QString type,
QString value);
void forEach(QAbstractItemModel* model, QModelIndex parent, QString str);
QModelIndex indexFind;
QVector<QModelIndex> indexFindList;
int indexCount = 0;
void openPlist(QString filePath = "");
int close_flag = -1;
QAction* actionUndo;
QAction* actionRedo;
void showMsg();
void loadPlistText(QString textFile);
void goPlistText();
void closeOpenedFile(QString file);
QFont getFont();
void checkReloadFilesByModi();
void ShowAutoUpdateDlg(bool Database);
int deleteDirfile(QString dirName);
QString getUrl(QVariantList list);
bool getBinPlist(QString filePath);
QDomDocument readXMLPlist(QDomDocument document, QString filePath);
QString getMD5(QString targetFile);
QString strOrgMD5;
QString strByModiMD5;
QStringList listOrgMD5;
void setOrgMD5(QString fileName);
QString getOrgMD5(QString fileName);
static QString getTextEditLineText(QTextEdit* txtEdit, int i);
QString readText(QString textFile);
static void TextEditToFile(QTextEdit* txtEdit, QString fileName);
void writeINITab();
void writeINIProxy();
QString getProxy();
QString mbarStyleLight = "QMenuBar{Background-color:rgb(236, 236, 236);}";
QString mbarStyleDark = "QMenuBar{Background-color:rgb(42, 42, 42);}";
QString sbarStyleLight =
"QStatusBar { background: rgb(236, 236, 236);}\
QStatusBar::item {\
border: 1px solid blue;\
border-radius: 3px;}";
QString sbarStyleDark =
"QStatusBar { background: rgb(50, 50, 50);}\
QStatusBar::item {\
border: 1px solid red;\
border-radius: 3px;}";
QString mainStyleLight =
"QFrame#frame\
{\
background-color: rgb(236, 236, 236);\
border-top-left-radius:10px;\
border-top-right-radius:10px;\
border-bottom-left-radius:10px;\
border-bottom-right-radius:10px;\
}";
QString mainStyleDark =
"QFrame#frame\
{\
background-color: rgb(66, 66, 66);\
border-top-left-radius:10px;\
border-top-right-radius:10px;\
border-bottom-left-radius:10px;\
border-bottom-right-radius:10px;\
}";
void init_UIStyle();
void clearTreeIndexWidget();
void setTitle(QString title);
void setModifyMarker();
static void init_MacVerInfo(QString ver);
static QString loadText(QString textFile);
public slots:
void on_Find();
void on_actionMoveUp();
void on_actionMoveDown();
void actionAdd_activated();
void actionRemove_activated();
bool eventFilter(QObject*, QEvent*) override;
virtual void changeEvent(QEvent* event) override;
void on_NewWindow();
private slots:
void recentOpen(QString filename);
void on_copyBW();
void on_pasteBW();
void actionNew();
void actionClose_activated();
void actionClose_all_activated();
void actionSave();
void actionSaveAs();
void actionExpand_all_activated();
void onTabWidget_currentChanged(int index);
void menu_aboutToShow();
void onCleanChanged(bool clean);
void openRecentFile();
void on_TabCloseRequest(int i = -1);
void on_copyAction();
void on_cutAction();
void on_pasteAction();
void on_expandAction();
void on_collapseAction();
void on_actionNewSibling();
void on_actionNewChild();
void replyFinished(QNetworkReply* reply);
void CheckUpdate();
void on_actionSort();
void on_actionShowPlistText_triggered(bool checked);
void on_actionPaste_as_child_triggered();
void on_editFind_returnPressed();
void on_editFind_textChanged(const QString& arg1);
void on_ShowFindReplace();
void on_btnFind_clicked();
void on_btnHideFind_clicked();
void on_btnNext_clicked();
void on_btnPrevious_clicked();
void on_btnReplace_clicked();
void on_btnReplaceAll_clicked();
void on_actionFind_triggered();
void on_actionFindNext_triggered();
void on_actionFindPrevious_triggered();
void on_actionReplace_triggered();
void on_actionReplaceAll_triggered();
void on_btnShowReplace_clicked();
void on_actionCut_triggered();
void on_actionCopy_between_windows_triggered();
void on_actionPaste_between_windows_triggered();
void on_actionCheck_Update_triggered();
void on_actionAbout_triggered();
void on_actionAdd_triggered();
void on_actionNew_Sibling_triggered();
void on_actionOpen_triggered();
void on_actionNew_triggered();
void on_actionSave_triggered();
void on_actionSave_as_triggered();
void on_listFind_itemClicked(QListWidgetItem* item);
void on_actionBug_Report_triggered();
void on_actionQuit_triggered();
void on_listFind_itemSelectionChanged();
void on_actionFont_triggered();
void on_listFind_currentRowChanged(int currentRow);
void on_btnNo_clicked();
void on_btnYes_clicked();
void on_actionDownload_Upgrade_Packages_triggered();
void on_btnUpdateASCII_clicked();
void on_btnUpdateBase64_clicked();
void on_btnUpdateHex_clicked();
void on_actProxy1_triggered();
void on_actProxy2_triggered();
void on_actProxy3_triggered();
void on_actProxy4_triggered();
void on_actProxy5_triggered();
void on_actionMove_Up_triggered();
void on_actionMove_Down_triggered();
void on_actionSort_triggered();
void on_actionExpand_All_triggered();
void on_actionCollapse_All_triggered();
void on_btnFind_Tool_clicked();
void on_btnReplaceFind_clicked();
void on_btnNew_clicked();
void on_btnSave_clicked();
void onTabBarClicked(int index);
private:
bool isDrag;
QPoint m_position;
bool useQtWriteXML = true;
RecentFiles* m_recentFiles;
QMenu* reFileMenu;
void initRecentFilesForToolBar();
void initMenuToolsBar();
void initFindReplace();
void initPlistTextShow();
QNetworkAccessManager* manager;
int parse_UpdateJSON(QString str);
bool blExit = false;
void setExpandText(EditorTab* tab);
void openFiles(QStringList list = QStringList());
void savePlist(QString filePath);
enum { MaxRecentFiles = 10 };
int findCount = 0;
bool find = false;
void reg_win();
QString ver;
QStringList FindTextList;
void setBarMarkers(int line);
QString getPlistTextValue(QString str);
MyHighLighter* myHL;
bool oneReplace = false;
QMenu* btnFindMenu;
QAction* actCaseSensitive = new QAction(tr("Case sensitive"), this);
QAction* actClearList = new QAction(tr("Clear List"), this);
QVector<QAction*> btnFindActionList;
void init_iniData();
void readINIProxy();
protected:
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
void closeEvent(QCloseEvent* event) override;
void resizeEvent(QResizeEvent* event) override;
void paintEvent(QPaintEvent* event) override;
void mousePressEvent(QMouseEvent*) override;
void mouseReleaseEvent(QMouseEvent*) override;
void mouseMoveEvent(QMouseEvent*) override;
};
#endif // MAINWINDOW_H