Add stop drainage automatically after 30 seconds.
This commit is contained in:
@@ -138,6 +138,10 @@ void DeviceManager::initDevice()
|
||||
mShutDownAction->setTimeoutInterval(SHUT_DOWN_TIMEOUT);
|
||||
mPumpControlAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_PUMP, this, "responsePumpControl(const QString&)", this);
|
||||
mPumpControlAction->setTimeoutInterval(PUMP_TIMEOUT);
|
||||
connect(mPumpControlAction, &DmsAsyncAction::timeout, this, [this]()
|
||||
{
|
||||
this->processPumpResult("{\"code\":-1}");
|
||||
});
|
||||
connect(mGetScanProgressAction, &DmsAsyncAction::timeout, this, &DeviceManager::scanTimeout);
|
||||
connect(mShutDownAction, &DmsAsyncAction::timeout, this, &DeviceManager::shutdownDmsFailed);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QButtonGroup>
|
||||
#include <QPainter>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <qdebug.h>
|
||||
|
||||
#include "forms/scan/PatientInformationForm.h"
|
||||
@@ -29,6 +30,7 @@ namespace{
|
||||
const size_t PREVIEW_COL = 140;
|
||||
const float PIXEL_SPACING = 1.5f;
|
||||
const float HALF_ROI_WIDTH = 100.0f;
|
||||
const unsigned int DRAINAGE_TIME = 30000;
|
||||
}
|
||||
|
||||
ScanFormWidget::ScanFormWidget(QWidget* parent)
|
||||
@@ -47,6 +49,7 @@ ScanFormWidget::ScanFormWidget(QWidget* parent)
|
||||
, mLblE(new QLabel(this))
|
||||
, mLblParams(new QLabel(this))
|
||||
, mLblE2(new QLabel(this))
|
||||
, mDrainageTimer(new QTimer(this))
|
||||
{
|
||||
|
||||
auto layout = new QHBoxLayout(ui->commandWidget);
|
||||
@@ -56,7 +59,11 @@ ScanFormWidget::ScanFormWidget(QWidget* parent)
|
||||
initScanControlBar(layout);
|
||||
initScanContent();
|
||||
initEvents();
|
||||
|
||||
mDrainageTimer->setSingleShot(true);
|
||||
connect(mDrainageTimer, &QTimer::timeout, this, [this]()
|
||||
{
|
||||
mBtnDrainage->click();
|
||||
});
|
||||
}
|
||||
|
||||
void ScanFormWidget::initProtocolUI(QHBoxLayout *layout) {
|
||||
@@ -171,6 +178,7 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
|
||||
mBtnDrainage->setEnabled(true);
|
||||
if(!aIsSucessful)
|
||||
{
|
||||
mDrainageTimer->stop();
|
||||
bool isChecked = mBtnDrainage->isChecked();
|
||||
mBtnDrainage->setChecked(!isChecked);
|
||||
if(isChecked)
|
||||
@@ -213,6 +221,7 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
|
||||
mBtnDrainage->setEnabled(false);
|
||||
if(aSatus == true)
|
||||
{
|
||||
mDrainageTimer->start(DRAINAGE_TIME);
|
||||
QString code = "1";
|
||||
mBtnDrainage->setText(tr("Drainaging"));
|
||||
EventCenter::Default()->triggerEvent(RequestDrainage, nullptr, (QObject*)(&code));
|
||||
@@ -220,6 +229,7 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
|
||||
}
|
||||
else
|
||||
{
|
||||
mDrainageTimer->stop();
|
||||
QString code = "0";
|
||||
mBtnDrainage->setText(tr("Drainage"));
|
||||
EventCenter::Default()->triggerEvent(RequestDrainage, nullptr, (QObject*)(&code));
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
QLabel* mLblE;
|
||||
QLabel* mLblParams;
|
||||
QLabel* mLblE2;
|
||||
QTimer* mDrainageTimer;
|
||||
void initProtocolUI(QHBoxLayout *layout);
|
||||
void initScanControlBar(QHBoxLayout *layout);
|
||||
void initScanContent();
|
||||
|
||||
Reference in New Issue
Block a user