Repository navigation
Expand file tree
/
Copy pathnetworkobserver.h
More file actions
84 lines (67 loc) · 1.91 KB
/
Copy pathnetworkobserver.h
File metadata and controls
84 lines (67 loc) · 1.91 KB
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
#pragma once
#include <QWidget>
#include <QTableView>
#include <QPushButton>
#include <QComboBox>
#include <QLabel>
#include <QThread>
#include <QTimer>
#include <QLineEdit>
#include <QTextEdit>
#include <QSortFilterProxyModel>
#include <QTranslator>
#include <QEvent>
#include "PacketModel.h"
#include "snifferworker.h"
#include "statswindow.h"
class NetworkObserver : public QWidget
{
Q_OBJECT
public:
explicit NetworkObserver(QWidget* parent = nullptr);
~NetworkObserver();
protected:
void changeEvent(QEvent* event) override;
private slots:
void onStartStopClicked();
void onSnifferFinished();
void onPacketsReady(const QVector<PacketDisplayData>& packets);
void processPacketBuffer();
void onClearClicked();
void onStatsClicked();
void onSaveClicked();
void onOpenClicked();
void onFilterTextChanged(const QString& text);
void onRowSelected(const QModelIndex& current, const QModelIndex& previous);
void onLanguageClicked();
void onAboutClicked();
private:
void loadAdapters();
void writePcapHeader(QFile& file);
void writePacketToPcap(QFile& file, const PacketDisplayData& pkt);
void retranslateUi();
QComboBox* m_adapterCombo;
QPushButton* m_startBtn;
QPushButton* m_clearBtn;
QPushButton* m_statsBtn;
QPushButton* m_saveBtn;
QPushButton* m_openBtn;
QPushButton* m_langBtn;
QPushButton* m_aboutBtn;
QLineEdit* m_filterEdit;
QLabel* m_statusLabel;
QLabel* m_adapterLabel;
QLabel* m_filterLabel;
QTableView* m_tableView;
QTextEdit* m_hexView;
PacketModel* m_model;
QSortFilterProxyModel* m_proxyModel;
QThread* m_workerThread = nullptr;
SnifferWorker* m_worker = nullptr;
QTimer* m_updateTimer;
QVector<PacketDisplayData> m_buffer;
StatsWindow* m_statsWindow = nullptr;
bool m_isCapturing = false;
QTranslator m_translator;
bool m_isRussian = false;
};