parent
1c633ff6d6
commit
d3d2efdf87
@ -0,0 +1,54 @@
|
|||||||
|
#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
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>WeighUI</class>
|
||||||
|
<widget class="QMainWindow" name="WeighUI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>WeighUI</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>27</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Loading…
Reference in New Issue