home.h 2.1 KB
Newer Older
代码海贼团船长's avatar
代码海贼团船长 已提交
1 2 3 4 5 6 7 8
//
// Created by 11518 on 2022/11/3.
//

#ifndef ZCOM_HOME_H
#define ZCOM_HOME_H

#include <QWidget>
9 10
#include <QMouseEvent>
#include <QRubberBand>
代码海贼团船长's avatar
代码海贼团船长 已提交
11 12 13 14
#include "singlesend.h"
#include "multiplesend.h"
#include "../control/zcontrol.h"

代码海贼团船长's avatar
代码海贼团船长 已提交
15

代码海贼团船长's avatar
代码海贼团船长 已提交
16 17 18 19 20 21 22 23 24
QT_BEGIN_NAMESPACE
namespace Ui { class Home; }
QT_END_NAMESPACE

class Home : public QWidget {
Q_OBJECT
protected:
    //! 重写定时器
    void timerEvent(QTimerEvent *event) override;
25 26 27 28
    //! 重写鼠标事件
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
代码海贼团船长's avatar
代码海贼团船长 已提交
29 30 31 32 33 34 35 36 37
public:
    explicit Home(QWidget *parent = nullptr);
    ~Home() override;
private slots:
    //! 打开/关闭串口按钮
    void slotPBnTtySetClicked();
    //! 串口名字改变
    void slotTtyNameTextChanged(const QString & ttyName);
    //! 波特率改变
38
    void slotBaudTextChanged(const QString &text);
代码海贼团船长's avatar
代码海贼团船长 已提交
39
    //! 停止位改变
40
    void slotStopTextChanged(const QString &text);
代码海贼团船长's avatar
代码海贼团船长 已提交
41
    //! 校验位改变
42
    void slotParityTextChanged(const QString &text);
代码海贼团船长's avatar
代码海贼团船长 已提交
43
    //! 数据位改变
44
    void slotDataTextChanged(const QString &text);
代码海贼团船长's avatar
代码海贼团船长 已提交
45 46 47
    //! 显示串口读到的数据
    void slotSerialRead();
    //! 串口写操作
48
    void slotSerialWrite(QByteArray array,bool isHex,bool isEnter);
代码海贼团船长's avatar
代码海贼团船长 已提交
49 50
    //! 串口发生错误操作
    void slotSerialError(QSerialPort::SerialPortError error);
代码海贼团船长's avatar
代码海贼团船长 已提交
51 52
    //! 循环获取串口列表
    void slotSerialPortListChange(const QStringList &list,QString currentTtyName);
53 54
    //! 16进制接收
    void slotHexShowStateChanged(int state);
代码海贼团船长's avatar
代码海贼团船长 已提交
55 56 57 58
private:
    Ui::Home *ui;
    int m_TimerId; //定时器ID,用来显示当前时间的定时器ID,每秒触发一次

59 60 61 62 63
    SingleSend *mpSingleSend; //单条发送的界面
    MultipleSend *mpMultipleSend; //多条发送的界面
    ZControl *mpZControl; //总控界面
    uint64_t m_SendNumber; //发送计数
    uint64_t m_RecNumber; //接收计数
64 65 66 67
    QByteArray m_RecShow; //接收展示

    QRubberBand *mpRubberBand;//橡皮筋
    QPoint m_Start; //橡皮筋起点
代码海贼团船长's avatar
代码海贼团船长 已提交
68 69 70 71
};


#endif //ZCOM_HOME_H