73 lines
1.4 KiB
C++
73 lines
1.4 KiB
C++
#ifndef NETWORKTESTWIDGET_H
|
|
#define NETWORKTESTWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QLineEdit>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QTextEdit>
|
|
#include <QProgressBar>
|
|
#include <QGroupBox>
|
|
#include <QTimer>
|
|
|
|
/**
|
|
* @brief 网络测试页面
|
|
* 提供网络连接测试和诊断功能
|
|
*/
|
|
class NetworkTestWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit NetworkTestWidget(QWidget *parent = nullptr);
|
|
|
|
signals:
|
|
void backRequested();
|
|
|
|
private slots:
|
|
void onPingTest();
|
|
void onSpeedTest();
|
|
void onDnsTest();
|
|
void onServerTest();
|
|
void onClearLog();
|
|
|
|
private:
|
|
void setupUI();
|
|
QWidget *createTitleBar();
|
|
QWidget *createTestPanel();
|
|
QWidget *createResultPanel();
|
|
void appendLog(const QString &message, const QString &color = "#333");
|
|
|
|
// 标题栏
|
|
QLabel *m_titleLabel;
|
|
QPushButton *m_backBtn;
|
|
|
|
// 测试面板
|
|
QLineEdit *m_hostEdit;
|
|
QLineEdit *m_serverEdit;
|
|
QLineEdit *m_portEdit;
|
|
QPushButton *m_pingBtn;
|
|
QPushButton *m_speedTestBtn;
|
|
QPushButton *m_dnsTestBtn;
|
|
QPushButton *m_serverTestBtn;
|
|
|
|
// 结果面板
|
|
QTextEdit *m_logEdit;
|
|
QProgressBar *m_progressBar;
|
|
QPushButton *m_clearBtn;
|
|
|
|
// 测试定时器
|
|
QTimer *m_testTimer;
|
|
int m_testStep;
|
|
|
|
// 样式常量
|
|
static const QString BUTTON_STYLE;
|
|
static const QString PRIMARY_BUTTON_STYLE;
|
|
static const QString INPUT_STYLE;
|
|
static const QString GROUP_STYLE;
|
|
};
|
|
|
|
#endif // NETWORKTESTWIDGET_H
|