forked from AlloyTeam/Rythem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
119 lines (98 loc) · 2.81 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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui>
#include <QtWidgets>
#include <QtCore>
#include <QtNetwork>
#include <QWebEnginePage>
#include "rytablemodel.h"
#include "proxy/rypipedata.h"
#include "rule/ryrulemanager.h"
#include "proxy/ryproxyserver.h"
#include "ryupdatechecker.h"
using namespace rule;
namespace Ui {
class MainWindow;
}
class RyPipeData;
class RyTableSortFilterProxyModel;
class QItemSelectionModel;
class RyJsBridge:public QObject{
Q_OBJECT
public:
RyJsBridge();
public slots:
QString doAction(int action,const QString msg,quint64 groupId=0);
QString getFile();
QString getDir();
QString getConfigs();
QString getFileList();
signals:
void ruleChanged(int action,QString json);
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent=0);
~MainWindow();
public slots:
void onNewPipe(RyPipeData_ptr);
void onPipeUpdate(RyPipeData_ptr);
void toggleProxy();
void onItemDoubleClicked(QModelIndex);
void onSelectionChange(QItemSelection selected,QItemSelection deselected);
void onWaterfallActionTriggered();
void onMessageFromOtherInstance();
void checkNewVersion();
void loadConfigPage();
public:
typedef struct __proxyInfo{
int enable;
QString proxyString;
QString pacUrl;
QString isUsingPac;
}ProxyInfo;
RyTableModel *pipeTableModel;
RyTableSortFilterProxyModel *sortFilterProxyModel;
private:
Ui::MainWindow *ui;
RyJsBridge *_jsBridge;
void createMenus();
RyProxyServer *_server;
bool _isUsingCapture;
ProxyInfo _previousProxyInfo;
QMenu *_fileMenu;
QMenu *_filterMenu;
QAction *_importSessionsAct;
QAction *_filterNoImagesAct;
QAction *_filterNo304sAct;
QAction *_filterShowMatchOnlyAct;
QAction *_captureAct;
QAction *_hideConnectTunnelAct;
QActionGroup *_limitGroup;
QMenu *_requestLimitMenu;
QAction *_setMaxRequest15Act;
QAction *_setMaxRequest30Act;
QAction *_setMaxRequest100Act;
QAction *_setMaxRequest500Act;
QItemSelectionModel *_itemSelectModel;
RyUpdateChecker *checker;
bool isFirstTimeToggle;
QMutex proxyMutex;
protected:
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
QSettings proxySetting;
private slots:
void addJsObject();
void onAction(QAction*);
void on_actionLongCache_triggered();
void toggleCapture();
void importSessions();
void onActionRemoveAll();
void on_actionDebug_triggered();
void on_actionCheckNew_triggered();
void onFilterTextChanged(QString);
};
#endif // MAINWINDOW_H