Refactory ScanFormWidget.
This commit is contained in:
@@ -23,46 +23,35 @@ PatientInformationForm::~PatientInformationForm()
|
||||
delete mJsonStr;
|
||||
}
|
||||
|
||||
void PatientInformationForm::setPatientInformation(PatientInformation* information) {
|
||||
if(information){
|
||||
mUI->lbl_ID->setText(information->ID);
|
||||
mUI->lbl_Date->setText(information->BirthDate);
|
||||
mUI->lbl_Name->setText(information->Name);
|
||||
mUI->lbl_Sex->setText(information->Sex);
|
||||
mUI->lbl_Acc->setText(information->AccessionNumber);
|
||||
void PatientInformationForm::setPatientInformation(PatientInformationPointer information) {
|
||||
if(information)
|
||||
{
|
||||
mUI->mPatientID->setText(information->ID);
|
||||
mUI->mPatientBirthday->setText(information->BirthDate);
|
||||
mUI->mPatientName->setText(information->Name);
|
||||
mUI->mPatientGender->setText(information->Sex);
|
||||
mUI->mPaitenAccessionNumber->setText(information->AccessionNumber);
|
||||
}
|
||||
else{
|
||||
mUI->lbl_ID->clear();
|
||||
mUI->lbl_Date->clear();
|
||||
mUI->lbl_Name->clear();
|
||||
mUI->lbl_Sex->clear();
|
||||
mUI->lbl_Acc->clear();
|
||||
else
|
||||
{
|
||||
mUI->mPatientID->clear();
|
||||
mUI->mPatientBirthday->clear();
|
||||
mUI->mPatientName->clear();
|
||||
mUI->mPatientGender->clear();
|
||||
mUI->mPaitenAccessionNumber->clear();
|
||||
}
|
||||
if (mInfo){
|
||||
if (mInfo)
|
||||
{
|
||||
mInfo->deleteLater();
|
||||
}
|
||||
mInfo = information;
|
||||
}
|
||||
|
||||
PatientInformation* PatientInformationForm::getPatientInformation()
|
||||
PatientInformationPointer PatientInformationForm::getPatientInformation()
|
||||
{
|
||||
return mInfo->Copy();
|
||||
}
|
||||
|
||||
void PatientInformationForm::setProtocol(int type) {
|
||||
mCurrentProtocol = type;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
mUI->lbl_Protocol->setText(tr("LEFT ONLY"));
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
mUI->lbl_Protocol->setText(tr("RIGHT ONLY"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int PatientInformationForm::getProtocol()
|
||||
{
|
||||
return mCurrentProtocol;
|
||||
@@ -70,7 +59,7 @@ int PatientInformationForm::getProtocol()
|
||||
|
||||
QString PatientInformationForm::getPatientID()
|
||||
{
|
||||
return mUI->lbl_ID->text();
|
||||
return mUI->mPatientID->text();
|
||||
}
|
||||
|
||||
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
|
||||
|
||||
@@ -14,9 +14,8 @@ class PatientInformationForm : public QWidget
|
||||
public:
|
||||
explicit PatientInformationForm(QWidget *parent = nullptr);
|
||||
~PatientInformationForm() override;
|
||||
void setPatientInformation(PatientInformation* information);
|
||||
PatientInformation* getPatientInformation();
|
||||
void setProtocol(int type);
|
||||
void setPatientInformation(PatientInformationPointer information);
|
||||
PatientInformationPointer getPatientInformation();
|
||||
int getProtocol();
|
||||
|
||||
const char * getCurrentPatientJsonString(bool emptyScan);
|
||||
@@ -24,7 +23,7 @@ public:
|
||||
|
||||
private:
|
||||
Ui::PatientInformationForm *mUI;
|
||||
PatientInformation* mInfo = nullptr;
|
||||
PatientInformationPointer mInfo;
|
||||
int mCurrentProtocol = 0;
|
||||
char * mJsonStr = nullptr;
|
||||
};
|
||||
|
||||
@@ -46,44 +46,108 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="patientTitle">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:#0078d8</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Patient Information</string>
|
||||
<string>Current Patient</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_ID">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>PatientID:</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Name">
|
||||
<property name="text">
|
||||
<string>Someone Somebody</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Date">
|
||||
<property name="text">
|
||||
<string>2021/11/11</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Sex">
|
||||
<property name="text">
|
||||
<string>Female</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Acc">
|
||||
<property name="text">
|
||||
<string>Acc# 27812398</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="mPatientInfomation" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mPatientNameLabel">
|
||||
<property name="text">
|
||||
<string>Patient Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="mPatientID">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="mPatientGender">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mPatientIDLabel">
|
||||
<property name="text">
|
||||
<string>Patient ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="mPatientBirthdayLabel">
|
||||
<property name="text">
|
||||
<string>Patient Birthday:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="mPatientBirthday">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="mPatientGenderLabel">
|
||||
<property name="text">
|
||||
<string>Patient Gender:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="mPaitenAccessionNumber">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="mPatientAccessionNumberLabel">
|
||||
<property name="text">
|
||||
<string>Patient AccessionNum:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="mPatientName">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="mScanProtocolLabel">
|
||||
<property name="text">
|
||||
<string>Scan Protocol:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="mScanProtocol">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -100,20 +164,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="protocolTitle">
|
||||
<property name="text">
|
||||
<string>Current Protocol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Protocol">
|
||||
<property name="text">
|
||||
<string>LEFT ONLY</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -32,196 +32,75 @@ namespace{
|
||||
}
|
||||
|
||||
ScanFormWidget::ScanFormWidget(QWidget* parent)
|
||||
: TabFormWidget(parent)
|
||||
, mPatInf(new PatientInformationForm(this))
|
||||
, mLblProtocol(new QLabel(this))
|
||||
, mBtnLeft(new QToolButton(this))
|
||||
, mBtnRight(new QToolButton(this))
|
||||
, mBtnEScan(new QToolButton(this))
|
||||
, mBtnPreview(new QToolButton(this))
|
||||
, mBtnStop(new QToolButton(this))
|
||||
, mBtnScan(new QToolButton(this))
|
||||
, mBtnDrainage(new QToolButton(this))
|
||||
, mViewer(new QLabel(this))
|
||||
, mLblPreview(new QLabel(this))
|
||||
, mLblE(new QLabel(this))
|
||||
, mLblParams(new QLabel(this))
|
||||
, mLblE2(new QLabel(this))
|
||||
, mDrainageTimer(new QTimer(this))
|
||||
: TabFormWidget(parent)
|
||||
, mPatInf(new PatientInformationForm(this))
|
||||
, mAccountButton(new QToolButton(this))
|
||||
, mShutdownButton(new QToolButton(this))
|
||||
, mWorklistButton(new QToolButton(this))
|
||||
, mStartScanButton(new QToolButton(this))
|
||||
, mDrainageButton(new QToolButton(this))
|
||||
, mXYLabel(new QLabel(this))
|
||||
, mZLabel(new QLabel(this))
|
||||
, mScanProcessLabel(new QLabel(this))
|
||||
, mDrainageTimer(new QTimer(this))
|
||||
{
|
||||
|
||||
auto layout = new QHBoxLayout(ui->commandWidget);
|
||||
initProtocolUI(layout);
|
||||
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
addVerticalLine(layout);
|
||||
initScanControlBar(layout);
|
||||
auto commandlayout = new QHBoxLayout(ui->commandWidget);
|
||||
initCommandWidget(commandlayout);
|
||||
|
||||
|
||||
//initScanControlBar(commandlayout);
|
||||
initScanContent();
|
||||
initEvents();
|
||||
mDrainageTimer->setSingleShot(true);
|
||||
connect(mDrainageTimer, &QTimer::timeout, this, [this]()
|
||||
{
|
||||
mBtnDrainage->click();
|
||||
mDrainageButton->click();
|
||||
});
|
||||
}
|
||||
|
||||
void ScanFormWidget::initProtocolUI(QHBoxLayout *layout) {
|
||||
mLblProtocol->setText(tr("Protocol"));
|
||||
mLblProtocol->setAlignment(Qt::AlignTop);
|
||||
mLblProtocol->setObjectName("protocolPanelTitle");
|
||||
layout->addWidget(mLblProtocol);
|
||||
void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
|
||||
{
|
||||
bool anonymousMode = JsonObject::Instance()->getAnonymousMode();
|
||||
mAccountButton->setObjectName("btnAccount");
|
||||
mAccountButton->setText(tr("Account"));
|
||||
layout->addWidget(mAccountButton);
|
||||
|
||||
mShutdownButton->setObjectName("btnShutDown");
|
||||
mShutdownButton->setText(tr("ShutDown"));
|
||||
layout->addWidget(mShutdownButton);
|
||||
|
||||
mWorklistButton->setObjectName("btnWorklist");
|
||||
mWorklistButton->setText(tr("Worklist"));
|
||||
mWorklistButton->setEnabled(!anonymousMode);
|
||||
layout->addWidget(mWorklistButton);
|
||||
|
||||
mStartScanButton->setObjectName("btnScan");
|
||||
mStartScanButton->setText(tr("Start Scan"));
|
||||
layout->addWidget(mStartScanButton);
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
addVerticalLine(layout);
|
||||
mBtnLeft->setObjectName("btnLeft");
|
||||
mBtnRight->setObjectName("btnRight");
|
||||
mBtnLeft->setText(tr("LEFT"));
|
||||
mBtnRight->setText(tr("RIGHT"));
|
||||
layout->addWidget(mBtnLeft);
|
||||
layout->addWidget(mBtnRight);
|
||||
|
||||
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)));
|
||||
}
|
||||
mDrainageButton->setObjectName("btnDrainage");
|
||||
mDrainageButton->setCheckable(true);
|
||||
mDrainageButton->setText(tr("Drainage"));
|
||||
layout->addWidget(mDrainageButton);
|
||||
|
||||
void ScanFormWidget::initScanContent() {
|
||||
auto contentLayout = new QHBoxLayout();
|
||||
ui->contentWidget->setLayout(contentLayout);
|
||||
|
||||
contentLayout->addWidget(mPatInf);
|
||||
auto paramWidget = new QWidget(this);
|
||||
auto broadcastWidget = new QWidget(this);
|
||||
broadcastWidget->setObjectName("broadcastWidget");
|
||||
mViewer->setObjectName("viewer");
|
||||
mViewer->setFixedSize(800, 800);
|
||||
mViewer->setText("");
|
||||
auto viewerLayout = new QHBoxLayout(mViewer);
|
||||
broadcastWidget->setLayout(viewerLayout);
|
||||
viewerLayout->addWidget(mViewer);
|
||||
contentLayout->addWidget(broadcastWidget);
|
||||
paramWidget->setObjectName("paramWidget");
|
||||
auto paramLayout = new QVBoxLayout(paramWidget);
|
||||
mLblPreview->setText(tr("Preview Parameters"));
|
||||
mLblPreview->setObjectName("parameterTitle");
|
||||
paramLayout->addWidget(mLblPreview);
|
||||
mLblE->setWordWrap(true);
|
||||
mLblE->setObjectName("placeholder");
|
||||
mLblE->setText(tr("some settings\n\nparameters\n"));
|
||||
paramLayout->addWidget(mLblE);
|
||||
auto lbl_end = new QLabel(this);
|
||||
lbl_end->setObjectName("endSpaceLine");
|
||||
paramLayout->addWidget(lbl_end);
|
||||
mLblParams->setText(tr("Scan Parameters"));
|
||||
mLblParams->setObjectName("parameterTitle");
|
||||
paramLayout->addWidget(mLblParams);
|
||||
mLblE2->setWordWrap(true);
|
||||
mLblE2->setObjectName("placeholder");
|
||||
mLblE2->setText(tr("some settings\n\nparameters\n"));
|
||||
paramLayout->addWidget(mLblE2);
|
||||
auto lbl_end2 = new QLabel(this);
|
||||
lbl_end2->setObjectName("endSpaceLine");
|
||||
paramLayout->addWidget(lbl_end2);
|
||||
paramLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||
contentLayout->addWidget(paramWidget);
|
||||
}
|
||||
|
||||
void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
|
||||
mBtnEScan->setObjectName("btnRefresh");
|
||||
mBtnPreview->setObjectName("btnPreview");
|
||||
mBtnStop->setObjectName("btnStop");
|
||||
mBtnScan->setObjectName("btnScan");
|
||||
mBtnDrainage->setObjectName("btnDrainage");
|
||||
mBtnDrainage->setCheckable(true);
|
||||
|
||||
mBtnEScan->setText(tr("Empty Scan"));
|
||||
mBtnPreview->setText(tr("Preview"));
|
||||
mBtnStop->setText(tr("Stop"));
|
||||
mBtnScan->setText(tr("Scan"));
|
||||
mBtnDrainage->setText(tr("Drainage"));
|
||||
|
||||
mBtnScan->setEnabled(false);
|
||||
mBtnEScan->setEnabled(false);
|
||||
mBtnPreview->setEnabled(false);
|
||||
mBtnStop->setEnabled(false);
|
||||
|
||||
layout->addWidget(mBtnEScan);
|
||||
layout->addWidget(mBtnPreview);
|
||||
layout->addWidget(mBtnStop);
|
||||
layout->addWidget(mBtnScan);
|
||||
layout->addWidget(mBtnDrainage);
|
||||
|
||||
connect(mBtnEScan, &QToolButton::clicked, [=]() {
|
||||
int result = DialogManager::Default()->requestAlertMessage(tr("Please make sure the holder is only contain water!"),DialogButtonMode::OkAndCancel,tr("Confirm Scan"));
|
||||
if (result != QDialog::Accepted)return;
|
||||
QString patientInf(mPatInf->getCurrentPatientJsonString(true));
|
||||
LOG_USER_OPERATION("Start Empty Scan")
|
||||
EventCenter::Default()->triggerEvent(RequestEmptyScan, nullptr, (QObject*)(&patientInf));
|
||||
});
|
||||
connect(mBtnPreview, &QToolButton::clicked, [=]() {
|
||||
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)
|
||||
connect(mDrainageButton, &QToolButton::clicked, [=](bool aSatus)
|
||||
{
|
||||
if(!aIsSucessful)
|
||||
{
|
||||
setPreviewing(false);
|
||||
}
|
||||
});
|
||||
connect(DeviceManager::Default(), &DeviceManager::startPumpControlResult, [this](bool aIsSucessful)
|
||||
{
|
||||
mBtnDrainage->setEnabled(true);
|
||||
if(!aIsSucessful)
|
||||
{
|
||||
mDrainageTimer->stop();
|
||||
bool isChecked = mBtnDrainage->isChecked();
|
||||
mBtnDrainage->setChecked(!isChecked);
|
||||
if(isChecked)
|
||||
{
|
||||
mBtnDrainage->setText(tr("Drainage"));
|
||||
}
|
||||
else
|
||||
{
|
||||
mBtnDrainage->setText(tr("Drainaging"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(mBtnScan, &QToolButton::clicked, [=]() {
|
||||
if(JsonObject::Instance()->getScanConfirm())
|
||||
{
|
||||
int ret = DialogManager::Default()->requestPatientConfirm(mPatInf->getPatientInformation(),mPatInf->getProtocol());
|
||||
if (ret != QDialog::Accepted) return;
|
||||
}
|
||||
QString patientInf(mPatInf->getCurrentPatientJsonString(false));
|
||||
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));
|
||||
return;
|
||||
}
|
||||
EventCenter::Default()->triggerEvent(RequestPatientScan, nullptr, (QObject*)(&patientInf));
|
||||
});
|
||||
connect(mBtnStop, &QToolButton::clicked, [=]() {
|
||||
LOG_USER_OPERATION("Stop Preview")
|
||||
EventCenter::Default()->triggerEvent(RequestPreviewStop, nullptr, nullptr);
|
||||
});
|
||||
connect(mBtnDrainage, &QToolButton::clicked, [=](bool aSatus) {
|
||||
//Drainage
|
||||
if(aSatus && DialogManager::Default()->requestAlertMessage(tr("Make sure to open the drain valve ?"), DialogButtonMode::OkAndCancel, tr("Confirm Drainage")) == QDialog::Rejected)
|
||||
{
|
||||
mBtnDrainage->setChecked(!aSatus);
|
||||
mDrainageButton->setChecked(!aSatus);
|
||||
return;
|
||||
}
|
||||
mBtnDrainage->setEnabled(false);
|
||||
mDrainageButton->setEnabled(false);
|
||||
if(aSatus == true)
|
||||
{
|
||||
mDrainageTimer->start(DRAINAGE_TIME);
|
||||
QString code = "1";
|
||||
mBtnDrainage->setText(tr("Drainaging"));
|
||||
mDrainageButton->setText(tr("Drainaging"));
|
||||
EventCenter::Default()->triggerEvent(RequestDrainage, nullptr, (QObject*)(&code));
|
||||
LOG_USER_OPERATION("Perform Drainage");
|
||||
}
|
||||
@@ -229,30 +108,159 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
|
||||
{
|
||||
mDrainageTimer->stop();
|
||||
QString code = "0";
|
||||
mBtnDrainage->setText(tr("Drainage"));
|
||||
mDrainageButton->setText(tr("Drainage"));
|
||||
EventCenter::Default()->triggerEvent(RequestDrainage, nullptr, (QObject*)(&code));
|
||||
LOG_USER_OPERATION("Stop Drainage");
|
||||
}
|
||||
});
|
||||
|
||||
connect(DeviceManager::Default(), &DeviceManager::startPumpControlResult, [this](bool aIsSucessful)
|
||||
{
|
||||
mDrainageButton->setEnabled(true);
|
||||
if(!aIsSucessful)
|
||||
{
|
||||
mDrainageTimer->stop();
|
||||
bool isChecked = mDrainageButton->isChecked();
|
||||
mDrainageButton->setChecked(!isChecked);
|
||||
if(isChecked)
|
||||
{
|
||||
mDrainageButton->setText(tr("Drainage"));
|
||||
}
|
||||
else
|
||||
{
|
||||
mDrainageButton->setText(tr("Drainaging"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(mAccountButton, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
|
||||
|
||||
connect(mShutdownButton, &QToolButton::clicked, []()
|
||||
{
|
||||
if(DialogManager::Default()->requestAlertMessage(QString(tr("Shut down now ?")), DialogButtonMode::OkAndCancel,tr("Shut Down")) == QDialog::Accepted)
|
||||
{
|
||||
LOG_USER_OPERATION("Shut Down")
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestShutdown, nullptr, nullptr);
|
||||
}
|
||||
});
|
||||
|
||||
connect(mWorklistButton, &QToolButton::clicked, [&]()
|
||||
{
|
||||
DialogManager::Default()->requestGetWorkList();
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &ScanFormWidget::updateDataByAnonymousMode);
|
||||
|
||||
|
||||
// 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::protocolChanged(int type) {
|
||||
mPatInf->setProtocol(type);
|
||||
void ScanFormWidget::initScanContent()
|
||||
{
|
||||
|
||||
QHBoxLayout* contentLayout = new QHBoxLayout(ui->contentWidget);
|
||||
contentLayout->addWidget(mPatInf);
|
||||
|
||||
QWidget* scanProcessWidget = new QWidget(this);
|
||||
scanProcessWidget->setObjectName("ScanProcessWidget");
|
||||
contentLayout->addWidget(scanProcessWidget);
|
||||
|
||||
QVBoxLayout* scanProcessLayout = new QVBoxLayout(scanProcessWidget);
|
||||
mScanProcessLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
mScanProcessLabel->setAlignment(Qt::AlignCenter);
|
||||
mScanProcessLabel->setObjectName("ScanProcessInformation");
|
||||
mScanProcessLabel->setText(tr("Please confirm checking patient information to start the process"));
|
||||
scanProcessLayout->addWidget(mScanProcessLabel);
|
||||
QWidget* displayWidget = new QWidget(this);
|
||||
scanProcessLayout->addWidget(displayWidget);
|
||||
|
||||
|
||||
|
||||
QHBoxLayout* displayLayout = new QHBoxLayout(displayWidget);
|
||||
QWidget* xyWidget = new QWidget(this);
|
||||
xyWidget->setObjectName("broadcastWidget");
|
||||
QHBoxLayout* xyLayout = new QHBoxLayout(xyWidget);
|
||||
xyLayout->addWidget(mXYLabel);
|
||||
displayLayout->addWidget(xyWidget);
|
||||
|
||||
QWidget* zWidget = new QWidget(this);
|
||||
zWidget->setObjectName("broadcastWidget");
|
||||
QHBoxLayout* zLayout = new QHBoxLayout(zWidget);
|
||||
zLayout->addWidget(mZLabel);
|
||||
displayLayout->addWidget(zWidget);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ScanFormWidget::initScanControlBar(QHBoxLayout *layout)
|
||||
{
|
||||
// connect(mBtnEScan, &QToolButton::clicked, [=]() {
|
||||
// int result = DialogManager::Default()->requestAlertMessage(tr("Please make sure the holder is only contain water!"),DialogButtonMode::OkAndCancel,tr("Confirm Scan"));
|
||||
// if (result != QDialog::Accepted)return;
|
||||
// QString patientInf(mPatInf->getCurrentPatientJsonString(true));
|
||||
// LOG_USER_OPERATION("Start Empty Scan")
|
||||
// EventCenter::Default()->triggerEvent(RequestEmptyScan, nullptr, (QObject*)(&patientInf));
|
||||
// });
|
||||
// connect(mBtnPreview, &QToolButton::clicked, [=]() {
|
||||
// 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(mBtnScan, &QToolButton::clicked, [=]() {
|
||||
// if(JsonObject::Instance()->getScanConfirm())
|
||||
// {
|
||||
// int ret = DialogManager::Default()->requestPatientConfirm(mPatInf->getPatientInformation(),mPatInf->getProtocol());
|
||||
// if (ret != QDialog::Accepted) return;
|
||||
// }
|
||||
// QString patientInf(mPatInf->getCurrentPatientJsonString(false));
|
||||
// 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));
|
||||
// return;
|
||||
// }
|
||||
// EventCenter::Default()->triggerEvent(RequestPatientScan, nullptr, (QObject*)(&patientInf));
|
||||
// });
|
||||
// connect(mBtnStop, &QToolButton::clicked, [=]() {
|
||||
// LOG_USER_OPERATION("Stop Preview")
|
||||
// EventCenter::Default()->triggerEvent(RequestPreviewStop, nullptr, nullptr);
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
void ScanFormWidget::protocolChanged(int type)
|
||||
{
|
||||
LOG_USER_OPERATION(QString("Select Laterality %1").arg(type == 0 ? "Left" : "Right"));
|
||||
}
|
||||
|
||||
void ScanFormWidget::setPreviewing(bool val) {
|
||||
mViewer->setVisible(val);
|
||||
mBtnPreview->setCheckable(val);
|
||||
mBtnPreview->setChecked(val);
|
||||
mBtnPreview->setEnabled(!val);
|
||||
mBtnEScan->setEnabled(!val);
|
||||
mBtnScan->setEnabled(!val);
|
||||
mBtnDrainage->setEnabled(!val);
|
||||
void ScanFormWidget::setPreviewing(bool val)
|
||||
{
|
||||
// mBtnPreview->setCheckable(val);
|
||||
// mBtnPreview->setChecked(val);
|
||||
// mBtnPreview->setEnabled(!val);
|
||||
// mBtnEScan->setEnabled(!val);
|
||||
// mBtnScan->setEnabled(!val);
|
||||
mDrainageButton->setEnabled(!val);
|
||||
|
||||
}
|
||||
|
||||
void ScanFormWidget::renderLoading() {
|
||||
void ScanFormWidget::renderLoading()
|
||||
{
|
||||
setPreviewing(true);
|
||||
|
||||
uchar c_data[PREVIEW_ROW][PREVIEW_COL];
|
||||
@@ -260,7 +268,6 @@ void ScanFormWidget::renderLoading() {
|
||||
memset(data_ptr, 0, PREVIEW_COL);
|
||||
}
|
||||
QImage img(c_data[0], PREVIEW_COL, PREVIEW_ROW, QImage::Format_Grayscale8);
|
||||
mViewer->setFixedSize(800, 800);
|
||||
QPixmap pic = QPixmap::fromImage(img).scaledToHeight(800, Qt::SmoothTransformation);
|
||||
QPainter painter(&pic);
|
||||
QPen pen;
|
||||
@@ -273,10 +280,10 @@ void ScanFormWidget::renderLoading() {
|
||||
pen.setColor(QColor(255, 255, 0));
|
||||
painter.setPen(pen);
|
||||
painter.drawText(400 - 13 * 5, 400 + 13, "Loading...");
|
||||
mViewer->setPixmap(pic);
|
||||
}
|
||||
|
||||
void ScanFormWidget::renderPreviewData(const QObject* /*sender*/,const QObject *data) {
|
||||
void ScanFormWidget::renderPreviewData(const QObject* /*sender*/,const QObject *data)
|
||||
{
|
||||
if (!data)return;
|
||||
auto array = (QByteArray*)data;
|
||||
auto raw_dataptr = (uchar*)array->data();
|
||||
@@ -286,7 +293,6 @@ void ScanFormWidget::renderPreviewData(const QObject* /*sender*/,const QObject *
|
||||
raw_dataptr += PREVIEW_COL;
|
||||
}
|
||||
QImage img(c_data[0], PREVIEW_COL, PREVIEW_ROW, QImage::Format_Grayscale8);
|
||||
mViewer->setFixedSize(800, 800);
|
||||
QPixmap pic = QPixmap::fromImage(img).scaledToHeight(800, Qt::SmoothTransformation);
|
||||
QPainter painter(&pic);
|
||||
QPen pen;
|
||||
@@ -311,25 +317,33 @@ void ScanFormWidget::renderPreviewData(const QObject* /*sender*/,const QObject *
|
||||
painter.drawText(400 - 13, borderSpacing + 30, "H");
|
||||
painter.drawText(400 - 13, 800 - borderSpacing - 13, "F");
|
||||
painter.drawText(borderSpacing + 6, borderSpacing + 30, "ROI");
|
||||
mViewer->setPixmap(pic);
|
||||
}
|
||||
|
||||
void ScanFormWidget::initEvents() {//Events---------------------------------------------------------------
|
||||
void ScanFormWidget::initEvents()
|
||||
{
|
||||
//Events---------------------------------------------------------------
|
||||
connect(EventCenter::Default(), &EventCenter::PatientSelected, [=](QObject* sender, QObject* data) {
|
||||
if (data)
|
||||
{
|
||||
mBtnScan->setEnabled(true);
|
||||
mBtnEScan->setEnabled(true);
|
||||
mBtnPreview->setEnabled(true);
|
||||
mBtnStop->setEnabled(true);
|
||||
PatientInformation* patientInfo = (PatientInformation*)data;
|
||||
DialogResult result = DialogManager::Default()->reuqestConfirmStartScan(patientInfo);
|
||||
if(result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
|
||||
mPatInf->setPatientInformation(patientInfo->Copy());
|
||||
}
|
||||
|
||||
// mBtnScan->setEnabled(true);
|
||||
// mBtnEScan->setEnabled(true);
|
||||
// mBtnPreview->setEnabled(true);
|
||||
// mBtnStop->setEnabled(true);
|
||||
}
|
||||
else{
|
||||
mBtnScan->setEnabled(false);
|
||||
mBtnEScan->setEnabled(false);
|
||||
mBtnPreview->setEnabled(false);
|
||||
mBtnStop->setEnabled(false);
|
||||
// mBtnScan->setEnabled(false);
|
||||
// mBtnEScan->setEnabled(false);
|
||||
// mBtnPreview->setEnabled(false);
|
||||
// mBtnStop->setEnabled(false);
|
||||
}
|
||||
mPatInf->setPatientInformation((PatientInformation*)data);
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::ResponseStopPreview, [=](QObject* sender, QObject* data) {
|
||||
setPreviewing(false);
|
||||
@@ -342,19 +356,19 @@ void ScanFormWidget::initEvents() {//Events-------------------------------------
|
||||
});
|
||||
}
|
||||
|
||||
void ScanFormWidget::reloadLanguage(){
|
||||
mBtnLeft->setText(tr("LEFT"));
|
||||
mBtnRight->setText(tr("RIGHT"));
|
||||
mBtnEScan->setText(tr("Empty Scan"));
|
||||
mBtnPreview->setText(tr("Preview"));
|
||||
mBtnStop->setText(tr("Stop"));
|
||||
mBtnScan->setText(tr("Scan"));
|
||||
mLblProtocol->setText(tr("Protocol"));
|
||||
mLblPreview->setText(tr("Preview Parameters"));
|
||||
mLblPreview->setText(tr("Scan Parameters"));
|
||||
mLblE->setText(tr("some settings\n\nparameters\n"));
|
||||
mLblE2->setText(tr("some settings\n\nparameters\n"));
|
||||
mBtnDrainage->isChecked() ? mBtnDrainage->setText(tr("Drainaging")) : mBtnDrainage->setText(tr("Drainage"));
|
||||
void ScanFormWidget::reloadLanguage()
|
||||
{
|
||||
mAccountButton->setText(tr("Account"));
|
||||
mShutdownButton->setText(tr("ShutDown"));
|
||||
mWorklistButton->setText(tr("Worklist"));
|
||||
mStartScanButton->setText(tr("Start Scan"));
|
||||
mDrainageButton->isChecked() ? mDrainageButton->setText(tr("Drainaging")) : mDrainageButton->setText(tr("Drainage"));
|
||||
}
|
||||
|
||||
void ScanFormWidget::updateDataByAnonymousMode()
|
||||
{
|
||||
bool anonymousMode = JsonObject::Instance()->getAnonymousMode();
|
||||
mWorklistButton->setEnabled(!anonymousMode);
|
||||
}
|
||||
|
||||
void ScanFormWidget::keyPressEvent(QKeyEvent* aEvent)
|
||||
|
||||
@@ -21,21 +21,16 @@ private:
|
||||
PatientInformationForm* mPatInf= nullptr;
|
||||
bool mUnInited = true;
|
||||
int mCurrentFrame = 0;
|
||||
QLabel* mLblProtocol;
|
||||
QToolButton* mBtnLeft;
|
||||
QToolButton* mBtnRight;
|
||||
QToolButton* mBtnEScan;
|
||||
QToolButton* mBtnPreview;
|
||||
QToolButton* mBtnStop;
|
||||
QToolButton* mBtnScan;
|
||||
QToolButton* mBtnDrainage;
|
||||
QLabel* mViewer;
|
||||
QLabel* mLblPreview;
|
||||
QLabel* mLblE;
|
||||
QLabel* mLblParams;
|
||||
QLabel* mLblE2;
|
||||
QToolButton* mAccountButton;
|
||||
QToolButton* mShutdownButton;
|
||||
QToolButton* mWorklistButton;
|
||||
QToolButton* mStartScanButton;
|
||||
QToolButton* mDrainageButton;
|
||||
QLabel* mXYLabel;
|
||||
QLabel* mZLabel;
|
||||
QLabel* mScanProcessLabel;
|
||||
QTimer* mDrainageTimer;
|
||||
void initProtocolUI(QHBoxLayout *layout);
|
||||
void initCommandWidget(QHBoxLayout *layout);
|
||||
void initScanControlBar(QHBoxLayout *layout);
|
||||
void initScanContent();
|
||||
void renderLoading();
|
||||
@@ -43,6 +38,7 @@ private:
|
||||
void reloadLanguage();
|
||||
private slots:
|
||||
void protocolChanged(int type);
|
||||
void updateDataByAnonymousMode();
|
||||
|
||||
void initEvents();
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ enum PatientInformationEnum{
|
||||
* @brief this class was designed to be a edit form,
|
||||
* but now has been change to a detail display class.
|
||||
*/
|
||||
|
||||
class PatientInformation:public QObject{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -47,9 +48,9 @@ public:
|
||||
this->AddDate = other.AddDate;
|
||||
}
|
||||
QString ScheduledStartDate;
|
||||
PatientInformation* Copy()
|
||||
QSharedPointer<PatientInformation> Copy()
|
||||
{
|
||||
PatientInformation* n=new PatientInformation;
|
||||
QSharedPointer<PatientInformation> n= QSharedPointer<PatientInformation>(new PatientInformation);
|
||||
n->PatientUID = this->PatientUID;
|
||||
n->ID = this->ID;
|
||||
n->Name = this->Name;
|
||||
@@ -61,5 +62,7 @@ public:
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
typedef QSharedPointer<PatientInformation> PatientInformationPointer;
|
||||
|
||||
#endif //GUI_PATIENTINFORMATION_H
|
||||
|
||||
@@ -175,7 +175,7 @@ void SelectFormWidget::delPatient() {
|
||||
}
|
||||
|
||||
void SelectFormWidget::selectPatient() {
|
||||
EventCenter::Default()->triggerEvent(PatientSelected, nullptr, patientDetailForm->getPatientInformation()->Copy());
|
||||
EventCenter::Default()->triggerEvent(PatientSelected, nullptr, (QObject*)patientDetailForm->getPatientInformation());
|
||||
selectedPatientUID = patientDetailForm->getPatientInformation()->PatientUID;
|
||||
LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
||||
}
|
||||
@@ -255,7 +255,7 @@ void SelectFormWidget::initDataModel() {
|
||||
mModel->setData(mModel->index(0,7),"");
|
||||
}
|
||||
|
||||
mModel->setHeaderData(1, Qt::Horizontal, "ID");
|
||||
mModel->setHeaderData(1, Qt::Horizontal, tr("ID"));
|
||||
mModel->setHeaderData(2, Qt::Horizontal, tr("AccessionNumber"));
|
||||
mModel->setHeaderData(3, Qt::Horizontal, tr("Name"));
|
||||
mModel->setHeaderData(4, Qt::Horizontal, tr("Birth Date"));
|
||||
|
||||
Reference in New Issue
Block a user