65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QLabel>
|
|
#include <QCheckBox>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QGridLayout>
|
|
#include <QGroupBox>
|
|
#include <QFileDialog>
|
|
#include <QMessageBox>
|
|
|
|
class PlotWidget;
|
|
class UdpReceiver;
|
|
class DataManager;
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
private slots:
|
|
void onStartStop();
|
|
void onOpenFile();
|
|
void onClear();
|
|
void onDataReceived(const QByteArray &data);
|
|
void onToggleChannel(int channel, bool visible);
|
|
|
|
private:
|
|
void setupUi();
|
|
void startReceiving();
|
|
void stopReceiving();
|
|
void processDataLine(const QString &line);
|
|
void loadAndDisplayFile(const QString &filePath);
|
|
|
|
// 控件
|
|
QLineEdit *m_portEdit;
|
|
QPushButton *m_startStopBtn;
|
|
QPushButton *m_openFileBtn;
|
|
QPushButton *m_clearBtn;
|
|
QLabel *m_statusLabel;
|
|
QLabel *m_packetLabel;
|
|
PlotWidget *m_plotWidget;
|
|
|
|
// 功能组件
|
|
UdpReceiver *m_udpReceiver;
|
|
DataManager *m_dataManager;
|
|
|
|
// 状态
|
|
bool m_isReceiving;
|
|
int m_packetCount;
|
|
QString m_dataDir;
|
|
|
|
// 通道选择复选框
|
|
QList<QCheckBox*> m_channelChecks;
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|