You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
#ifndef WEIGHUI_H
|
|
#define WEIGHUI_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QTimer>
|
|
#include <QLabel>
|
|
#include <QPixmap>
|
|
#include <memory>
|
|
#include <thread>
|
|
|
|
class DdsSubscriberApp;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui {
|
|
class WeighUI;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class WeighUI : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit WeighUI(int domainId = 0, QWidget *parent = nullptr);
|
|
~WeighUI();
|
|
|
|
private slots:
|
|
void onCheckQueueSuccess(); // 定时检查队列,有 QueueSuccess 数据就弹窗+播放
|
|
void onShowPopup(const QString& popupText); // 显示弹窗
|
|
void onPopupClosed(); // 弹窗关闭后处理
|
|
void onCheckSummaryUpdate(); // 定时检查 SummaryUpdate 队列,播放 readcardstart 提示音
|
|
|
|
private:
|
|
void startDdsSubscriber(); // 启动 DDS 订阅线程
|
|
void stopDdsSubscriber(); // 停止 DDS 订阅线程
|
|
|
|
Ui::WeighUI *ui;
|
|
QTimer *m_closeTimer; // 关闭弹窗定时器
|
|
QTimer *m_pollTimer; // 轮询 QueueSuccess 队列的定时器
|
|
QTimer *m_summaryPollTimer; // 轮询 SummaryUpdate 队列的定时器
|
|
QLabel *m_imageLabel; // 显示图片的Label
|
|
QWidget *m_popupWidget; // 弹窗Widget (QueueSuccess 弹窗, 单独顶层窗口, 5秒后自动关闭)
|
|
|
|
|
|
std::shared_ptr<DdsSubscriberApp> m_ddsSubscriber;
|
|
std::thread *m_ddsThread; // DDS 订阅线程
|
|
|
|
int m_domainId = 0; // DDS domain id (可由 --domain 覆盖)
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event) override; // 关闭事件
|
|
};
|
|
|
|
#endif // WEIGHUI_H
|