refactor: Scan process.
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
#include "json/jsonobject.h"
|
||||
#include "device/DeviceManager.h"
|
||||
#include "dicom/WorkListManager.h"
|
||||
#include "components/CoordinateXYWidget.h"
|
||||
#include "components/CoordinateZWidget.h"
|
||||
#include "utilities/ScanProcessSequence.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#else
|
||||
@@ -39,8 +42,8 @@ ScanFormWidget::ScanFormWidget(QWidget* parent)
|
||||
, mWorklistButton(new QToolButton(this))
|
||||
, mStartScanButton(new QToolButton(this))
|
||||
, mDrainageButton(new QToolButton(this))
|
||||
, mXYLabel(new QLabel(this))
|
||||
, mZLabel(new QLabel(this))
|
||||
, mXYLabel(new CoordinateXYWidget(this))
|
||||
, mZLabel(new CoordinateZWidget(this))
|
||||
, mScanProcessLabel(new QLabel(this))
|
||||
, mDrainageTimer(new QTimer(this))
|
||||
{
|
||||
@@ -78,6 +81,8 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
|
||||
mStartScanButton->setObjectName("btnScan");
|
||||
mStartScanButton->setText(tr("Start Scan"));
|
||||
layout->addWidget(mStartScanButton);
|
||||
mStartScanButton->setEnabled(false);
|
||||
mStartScanButton->setCheckable(true);
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
addVerticalLine(layout);
|
||||
@@ -151,14 +156,58 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &ScanFormWidget::updateDataByAnonymousMode);
|
||||
|
||||
connect(mStartScanButton, &QToolButton::clicked, [this]()
|
||||
{
|
||||
if(mStartScanButton->isChecked())
|
||||
{
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::StartScanProcess, nullptr, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::StopScanProcess, nullptr, nullptr);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
connect(DeviceManager::Default(), &DeviceManager::startAutoLocateResult, [this]()
|
||||
{
|
||||
mWorklistButton->setEnabled(false);
|
||||
mAccountButton->setEnabled(false);
|
||||
mDrainageButton->setEnabled(false);
|
||||
mShutdownButton->setEnabled(false);
|
||||
mStartScanButton->setText(tr("Stop Scan Process"));
|
||||
mScanProcessLabel->setText(getAutoLocateMessage());
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::RequestFullScanStop, EventCenter::Default(), &EventCenter::StopScanProcess);
|
||||
connect(EventCenter::Default(), &EventCenter::StopScanProcess, [this]()
|
||||
{
|
||||
mWorklistButton->setEnabled(true);
|
||||
mAccountButton->setEnabled(true);
|
||||
mDrainageButton->setEnabled(true);
|
||||
mShutdownButton->setEnabled(true);
|
||||
mStartScanButton->setChecked(false);
|
||||
mStartScanButton->setText(tr("Start Scan"));
|
||||
if(ScanProcessSequence::getInstance()->getScanPositionSize() == 0)
|
||||
{
|
||||
mStartScanButton->setEnabled(false);
|
||||
mPatInf->clear();
|
||||
}
|
||||
mScanProcessLabel->setText(tr("Please confirm checking patient information to start the process"));
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::RequestPatientScan, [this]()
|
||||
{
|
||||
mScanProcessLabel->setText(tr("Data scanning, please keep the current position and don't move."));
|
||||
});
|
||||
|
||||
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::fullScanDataExport, [this]()
|
||||
{
|
||||
mScanProcessLabel->setText(tr("Data exporting, patient can leave the holder"));
|
||||
});
|
||||
|
||||
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::startFullScan, this, &ScanFormWidget::prepareStartFullScan, Qt::QueuedConnection);
|
||||
|
||||
// auto group = new QButtonGroup(ui->commandWidget);
|
||||
// mBtnLeft->setCheckable(true);
|
||||
// mBtnLeft->setChecked(true);
|
||||
// mBtnRight->setCheckable(true);
|
||||
// group->addButton(mBtnRight, 1);
|
||||
// group->addButton(mBtnLeft, 0);
|
||||
// connect(group, SIGNAL(buttonClicked(int)), this, SLOT(protocolChanged(int)));
|
||||
}
|
||||
|
||||
void ScanFormWidget::initScanContent()
|
||||
@@ -212,13 +261,6 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout)
|
||||
// EventCenter::Default()->triggerEvent(RequestPreviewScan, nullptr, nullptr);
|
||||
|
||||
// });
|
||||
connect(DeviceManager::Default(), &DeviceManager::startPreviewScanResult, [this](bool aIsSucessful)
|
||||
{
|
||||
if(!aIsSucessful)
|
||||
{
|
||||
setPreviewing(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// connect(mBtnScan, &QToolButton::clicked, [=]() {
|
||||
@@ -248,6 +290,15 @@ void ScanFormWidget::protocolChanged(int type)
|
||||
LOG_USER_OPERATION(QString("Select Laterality %1").arg(type == 0 ? "Left" : "Right"));
|
||||
}
|
||||
|
||||
void ScanFormWidget::prepareStartFullScan()
|
||||
{
|
||||
ScanPosition position = ScanProcessSequence::getInstance()->topPosition();
|
||||
mPatInf->setExecuteProtocol(position == ScanPosition::Left);
|
||||
QString patientInf(mPatInf->getCurrentPatientJsonString(false));
|
||||
LOG_USER_OPERATION(QString("Start Scan, ID: %1").arg(mPatInf->getPatientID()))
|
||||
EventCenter::Default()->triggerEvent(RequestPatientScan, nullptr, (QObject*)(&patientInf));
|
||||
}
|
||||
|
||||
void ScanFormWidget::setPreviewing(bool val)
|
||||
{
|
||||
// mBtnPreview->setCheckable(val);
|
||||
@@ -329,9 +380,13 @@ void ScanFormWidget::initEvents()
|
||||
DialogResult result = DialogManager::Default()->reuqestConfirmStartScan(patientInfo);
|
||||
if(result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
mPatInf->setPatientInformation(patientInfo->Copy(), static_cast<ScanProtocal>(result.ResultData.toInt()));
|
||||
ScanProtocal protocal = static_cast<ScanProtocal>(result.ResultData.toInt());
|
||||
mPatInf->setPatientInformation(patientInfo->Copy(), protocal);
|
||||
setScanProtocal(protocal);
|
||||
LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientInfo->ID))
|
||||
EventCenter::Default()->triggerEvent(StartScanProcess, nullptr, patientInfo);
|
||||
mStartScanButton->setEnabled(true);
|
||||
EventCenter::Default()->triggerEvent(SetSelectedPatient, nullptr, patientInfo);
|
||||
mStartScanButton->click();
|
||||
}
|
||||
|
||||
// mBtnScan->setEnabled(true);
|
||||
@@ -372,6 +427,44 @@ void ScanFormWidget::updateDataByAnonymousMode()
|
||||
mWorklistButton->setEnabled(!anonymousMode);
|
||||
}
|
||||
|
||||
QString ScanFormWidget::getAutoLocateMessage()
|
||||
{
|
||||
ScanPosition position = ScanProcessSequence::getInstance()->topPosition();
|
||||
switch (position)
|
||||
{
|
||||
case ScanPosition::Left:
|
||||
return tr("Left side scan initiated, auto positioning in progress.");
|
||||
case ScanPosition::Right:
|
||||
return tr("Right side scan initiated, auto positioning in progress.");
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
void ScanFormWidget::setScanProtocal(int aProtocal)
|
||||
{
|
||||
ScanProcessSequence::getInstance()->clear();
|
||||
switch (aProtocal)
|
||||
{
|
||||
case ScanProtocal::LSTAND:
|
||||
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Right);
|
||||
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Left);
|
||||
return;
|
||||
case ScanProtocal::RSTAND:
|
||||
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Left);
|
||||
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Right);
|
||||
return;
|
||||
case ScanProtocal::LONE:
|
||||
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Left);
|
||||
return;
|
||||
case ScanProtocal::RONE:
|
||||
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Right);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScanFormWidget::keyPressEvent(QKeyEvent* aEvent)
|
||||
{
|
||||
switch (aEvent->key())
|
||||
|
||||
Reference in New Issue
Block a user