Fix when dms disconnect, preview button and dranage button is checkable.

This commit is contained in:
sunwen
2023-09-05 14:27:30 +08:00
parent 7600f573f0
commit c988dfe394
3 changed files with 51 additions and 10 deletions

View File

@@ -148,16 +148,40 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
connect(mBtnRefresh, &QToolButton::clicked, [=]() {
QString patientInf(mPatInf->getCurrentPatientJsonString(true));
LOG_USER_OPERATION(StartRefresh)
LOG_USER_OPERATION("Start Empty Scan")
EventCenter::Default()->triggerEvent(RequestEmptyScan, nullptr, (QObject*)(&patientInf));
});
connect(mBtnPreview, &QToolButton::clicked, [=]() {
LOG_USER_OPERATION(StartPreview)
LOG_USER_OPERATION(QString("Start Preview, ID: %1").arg(mPatInf->getPatientID()))
EventCenter::Default()->triggerEvent(RequestPreviewScan, nullptr, nullptr);
});
connect(DeviceManager::Default(), &DeviceManager::startPreviewScanResult, [this](bool aIsSucessful)
{
if(!aIsSucessful)
{
setPreviewing(false);
}
});
connect(DeviceManager::Default(), &DeviceManager::startPumpControlResult, [this](bool aIsSucessful)
{
if(!aIsSucessful)
{
bool isChecked = mBtnDrainage->isChecked();
mBtnDrainage->setChecked(!isChecked);
if(isChecked)
{
mBtnDrainage->setText(tr("Drainage"));
}
else
{
mBtnDrainage->setText(tr("Drainaging"));
}
}
});
connect(mBtnScan, &QToolButton::clicked, [=]() {
QString patientInf(mPatInf->getCurrentPatientJsonString(false));
LOG_USER_OPERATION(StartScan)
LOG_USER_OPERATION(QString("Start Scan, ID: %1").arg(mPatInf->getPatientID()))
if (!DeviceManager::Default()->hasValidEmptyScan()){
QString msg(tr("No refresh data exists, please do Refresh operation first."));
EventCenter::Default()->triggerEvent(DeviceErrorRaise, nullptr, (QObject*)(&msg));
@@ -166,7 +190,7 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
EventCenter::Default()->triggerEvent(RequestPatientScan, nullptr, (QObject*)(&patientInf));
});
connect(mBtnStop, &QToolButton::clicked, [=]() {
LOG_USER_OPERATION(Stop)
LOG_USER_OPERATION("Stop Preview")
EventCenter::Default()->triggerEvent(RequestPreviewStop, nullptr, nullptr);
});
connect(mBtnDrainage, &QToolButton::clicked, [=](bool aSatus) {
@@ -176,19 +200,21 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
QString code = "1";
mBtnDrainage->setText(tr("Drainaging"));
EventCenter::Default()->triggerEvent(RequestDrainage, nullptr, (QObject*)(&code));
LOG_USER_OPERATION("Perform Drainage");
}
else
{
QString code = "0";
mBtnDrainage->setText(tr("Drainage"));
EventCenter::Default()->triggerEvent(RequestDrainage, nullptr, (QObject*)(&code));
LOG_USER_OPERATION("Stop Drainage");
}
});
}
void ScanFormWidget::protocolChanged(int type) {
printf("%d\r\n", type);
mPatInf->setProtocol(type);
LOG_USER_OPERATION(QString("Select Laterality %1").arg(type == 0 ? "Left" : "Right"));
}
void ScanFormWidget::setPreviewing(bool val) {
@@ -284,9 +310,6 @@ void ScanFormWidget::initEvents() {//Events-------------------------------------
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this, &ScanFormWidget::reloadLanguage);
connect(EventCenter::Default(), &EventCenter::DeviceErrorRaise, [=](QObject* parent, QObject* msg){
printf("signal:%d\r\n",senderSignalIndex());
setPreviewing(false);
mBtnDrainage->setChecked(false);
mBtnDrainage->setText(tr("Drainage"));
});
}