Add remind user to execute empty scan.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "db/SQLHelper.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -11,6 +12,8 @@
|
||||
|
||||
SystemCorrectionForm::SystemCorrectionForm(QWidget* aParent)
|
||||
: QWidget(aParent)
|
||||
, mCurrentEmptyScanDate(new QLabel(this))
|
||||
, mExpirationEmptyScanDate(new QLabel(this))
|
||||
{
|
||||
setObjectName("SystemCorrectionForm");
|
||||
init();
|
||||
@@ -53,18 +56,16 @@ void SystemCorrectionForm::init()
|
||||
endline->setFixedHeight(3);
|
||||
vboxLayout->addWidget(endline);
|
||||
|
||||
QLabel* currentEmptyScanDate = new QLabel(this);
|
||||
QDate lastScanDate = SQLHelper::queryValue("SELECT ScanDateTime FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toDate();
|
||||
currentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
vboxLayout->addWidget(currentEmptyScanDate);
|
||||
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
vboxLayout->addWidget(mCurrentEmptyScanDate);
|
||||
|
||||
QLabel* expirationEmptyScanDate = new QLabel(this);
|
||||
QDate expirationScanDate = lastScanDate.addMonths(1);
|
||||
QDate currentDate = QDate::currentDate();
|
||||
QString dateText = tr("%1-%2-%3").arg(expirationScanDate.year()).arg(expirationScanDate.month()).arg(expirationScanDate.day());;
|
||||
QString dateFormat = currentDate.daysTo(expirationScanDate) < 3 ? QString("<font color='red'> %1</font>").arg(dateText) : QString(" %1").arg(dateText);
|
||||
expirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
vboxLayout->addWidget(expirationEmptyScanDate);
|
||||
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
vboxLayout->addWidget(mExpirationEmptyScanDate);
|
||||
|
||||
QWidget* emptyScanButtonArea = new QWidget(this);
|
||||
QHBoxLayout* emptyScanButtonLayout = new QHBoxLayout(emptyScanButtonArea);
|
||||
@@ -87,8 +88,8 @@ void SystemCorrectionForm::init()
|
||||
title->setText(tr("Scan Preparation"));
|
||||
emptyScanTitle->setText(tr("Empty Scan"));
|
||||
emptyScanDescribe->setText(tr("Empty water scanning involves collecting ultrasound data while the tank is filled with water and free of any objects. It is essential to ensure that the tank is fully filled with water and devoid of any objects before conducting the scan. The purpose of collecting empty water data is to obtain baseline information on the time and energy variations of ultrasound propagation inside the inspection tank. This information is utilized for reconstructing reference data for transmission ultrasound imaging. Additionally, empty water data can be utilized for system status assessment and spatial calibration of the system. Therefore, empty water scanning should be performed regularly, with a frequency of once every month."));
|
||||
currentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
expirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
emptyScanButton->setText(tr("Excute empty scan"));
|
||||
});
|
||||
|
||||
@@ -101,6 +102,19 @@ void SystemCorrectionForm::init()
|
||||
}
|
||||
QString null;
|
||||
EventCenter::Default()->triggerEvent(RequestEmptyScan, nullptr, (QObject*)&null);
|
||||
LOG_USER_OPERATION("Start Empty Scan")
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::EmptyScanFinished, this, &SystemCorrectionForm::updateEmptyScanDate);
|
||||
|
||||
}
|
||||
|
||||
void SystemCorrectionForm::updateEmptyScanDate()
|
||||
{
|
||||
QDate lastScanDate = QDate::currentDate();
|
||||
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
QDate expirationScanDate = lastScanDate.addMonths(1);
|
||||
QString dateText = tr("%1-%2-%3").arg(expirationScanDate.year()).arg(expirationScanDate.month()).arg(expirationScanDate.day());;
|
||||
QString dateFormat = QString(" %1").arg(dateText);
|
||||
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class SystemCorrectionForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -13,6 +15,13 @@ public:
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
private slots:
|
||||
void updateEmptyScanDate();
|
||||
|
||||
private:
|
||||
QLabel* mCurrentEmptyScanDate;
|
||||
QLabel* mExpirationEmptyScanDate;
|
||||
};
|
||||
|
||||
#endif // SYSTEMCORRECTIONFORM_H
|
||||
|
||||
Reference in New Issue
Block a user