增加通讯协议
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include "titlebar.h"
|
||||
#include "statusstrip.h"
|
||||
#include "datacard.h"
|
||||
#include "udpcommunication.h"
|
||||
#include "car.h"
|
||||
#include "confirmdialog.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
@@ -28,8 +28,8 @@ GasDetectorPage::GasDetectorPage(AppContext* ctx, QWidget* parent)
|
||||
// 中央卡片区(2×2)
|
||||
QWidget* center = new QWidget(this);
|
||||
QGridLayout* grid = new QGridLayout(center);
|
||||
grid->setSpacing(16);
|
||||
grid->setContentsMargins(0, 0, 0, 0);
|
||||
grid->setSpacing(20);
|
||||
grid->setContentsMargins(20, 0, 20, 0);
|
||||
|
||||
m_chassisCard = new DataCard("底盘", center);
|
||||
m_chassisCard->addField("电量", "85%");
|
||||
@@ -60,11 +60,11 @@ GasDetectorPage::GasDetectorPage(AppContext* ctx, QWidget* parent)
|
||||
// 右侧按钮列(垂直居中 + 平均分布)
|
||||
QWidget* right = new QWidget(this);
|
||||
QVBoxLayout* rightLay = new QVBoxLayout(right);
|
||||
rightLay->setContentsMargins(0, 0, 0, 0);
|
||||
rightLay->setContentsMargins(40, 40, 40, 40);
|
||||
rightLay->setSpacing(8);
|
||||
|
||||
m_start = button("启动", "primary", right);
|
||||
m_start->setFixedHeight(180);
|
||||
m_start->setFixedHeight(100);
|
||||
connect(m_start, &QPushButton::clicked, this, [this]() {
|
||||
this->ctx()->comm()->sendGasStart();
|
||||
this->ctx()->gasRunning = true;
|
||||
@@ -72,7 +72,7 @@ GasDetectorPage::GasDetectorPage(AppContext* ctx, QWidget* parent)
|
||||
});
|
||||
|
||||
m_stop = button("停机", "", right);
|
||||
m_stop->setFixedHeight(180);
|
||||
m_stop->setFixedHeight(100);
|
||||
connect(m_stop, &QPushButton::clicked, this, [this]() {
|
||||
this->ctx()->comm()->sendGasStop();
|
||||
this->ctx()->gasRunning = false;
|
||||
@@ -90,9 +90,9 @@ GasDetectorPage::GasDetectorPage(AppContext* ctx, QWidget* parent)
|
||||
root->addLayout(main, 1);
|
||||
|
||||
m_statusStrip = new StatusStrip(ctx, this);
|
||||
m_statusStrip->setModeVisible(false); // 本页不显示模式徽标
|
||||
connect(m_statusStrip, &StatusStrip::backClicked, this, [this]() {
|
||||
if (this->ctx()->gasRunning) {
|
||||
// 【设计建议】检测中返回弹提示
|
||||
if (ConfirmDialog::confirm(this, "提示", "检测仍在进行,是否退出?"))
|
||||
emit navigate(PageJob);
|
||||
} else {
|
||||
@@ -101,7 +101,7 @@ GasDetectorPage::GasDetectorPage(AppContext* ctx, QWidget* parent)
|
||||
});
|
||||
root->addWidget(m_statusStrip);
|
||||
|
||||
connect(ctx->comm(), &UdpCommunication::telemetryUpdated, this, &GasDetectorPage::refresh);
|
||||
connect(ctx->comm(), &CarCommunication::telemetryUpdated, this, &GasDetectorPage::refresh);
|
||||
updateGating();
|
||||
refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user