From 0ae12bece872bed76ca2eb1e56bf6ece826d5419 Mon Sep 17 00:00:00 2001 From: sunwen Date: Tue, 29 Oct 2024 13:57:29 +0800 Subject: [PATCH] feat: Add loading after stop scan action. --- src/dialogs/DialogManager.cpp | 9 ++ src/dialogs/DialogManager.h | 1 + src/dialogs/GUIMessageDialog.cpp | 3 + src/dialogs/StopScanLoadingDialog.cpp | 58 ++++++++++++ src/dialogs/StopScanLoadingDialog.h | 25 ++++++ src/stylesheet/Dark2.css | 21 +++++ src/translations/en_US.ts | 7 ++ src/translations/zh_CN.ts | 122 ++++++++++++++------------ 8 files changed, 189 insertions(+), 57 deletions(-) create mode 100644 src/dialogs/StopScanLoadingDialog.cpp create mode 100644 src/dialogs/StopScanLoadingDialog.h diff --git a/src/dialogs/DialogManager.cpp b/src/dialogs/DialogManager.cpp index ec4549a..8885648 100644 --- a/src/dialogs/DialogManager.cpp +++ b/src/dialogs/DialogManager.cpp @@ -24,6 +24,7 @@ #include "dialogs/StartScanProcessDialog.h" #include "dialogs/CEchoTestDialog.h" #include "dialogs/WorklistLoadingDialog.h" +#include "dialogs/StopScanLoadingDialog.h" #include "network/DicomCfgDialog.h" #include "network/GetAdminPsw.h" @@ -483,6 +484,14 @@ void DialogManager::requestLoadingWorklist() mWorklistLoadingDialog->exec(); } +void DialogManager::requestStopScanLoadingDialog() +{ + StopScanLoadingDialog dialog(mTopWidget); + setTopWidget(&dialog); + dialog.exec(); + releaseTopWidget(&dialog); +} + void DialogManager::raiseDeviceInfo(QObject* parent, QObject* aInfoData) { QPair* infoData = (QPair*)(aInfoData); diff --git a/src/dialogs/DialogManager.h b/src/dialogs/DialogManager.h index a1c8bdb..1743b2c 100644 --- a/src/dialogs/DialogManager.h +++ b/src/dialogs/DialogManager.h @@ -88,6 +88,7 @@ public: void invokeOperationEnd(QObject* parent, QObject* msg); void setFocusToTopDialog(); void requestLoadingWorklist(); + void requestStopScanLoadingDialog(); void requestEmergencyButtonPushed(bool aIsLeftButton, bool aIsRest); private: diff --git a/src/dialogs/GUIMessageDialog.cpp b/src/dialogs/GUIMessageDialog.cpp index 1717eb3..a2852e6 100644 --- a/src/dialogs/GUIMessageDialog.cpp +++ b/src/dialogs/GUIMessageDialog.cpp @@ -3,9 +3,11 @@ #include #include +#include #include "event/EventCenter.h" #include "log/LogManager.h" +#include "dialogs/DialogManager.h" GUIMessageDialog::GUIMessageDialog(QWidget *parent) : QDialog(parent) @@ -118,6 +120,7 @@ void GUIMessageDialog::startLoading() { accept(); LOG_USER_OPERATION("Stop Scan"); EventCenter::Default()->triggerEvent(GUIEvents::RequestFullScanStop, nullptr, nullptr); + DialogManager::Default()->requestStopScanLoadingDialog(); }); connect(mConfirmCancleButton, &QToolButton::clicked, [=]() diff --git a/src/dialogs/StopScanLoadingDialog.cpp b/src/dialogs/StopScanLoadingDialog.cpp new file mode 100644 index 0000000..358d0ff --- /dev/null +++ b/src/dialogs/StopScanLoadingDialog.cpp @@ -0,0 +1,58 @@ +#include "StopScanLoadingDialog.h" + +#include +#include +#include +#include + +#include "components/LoadingWidget.h" + +namespace +{ + const int LOADING_TIME = 3000; +} + +StopScanLoadingDialog::StopScanLoadingDialog(QWidget* aParent, Qt::WindowFlags aFlag) + : GUIFormBaseDialog (aParent, aFlag) + , mLoadingWidget(new LoadingWidget(mFormWidget)) + , mTimer(new QTimer(this)) +{ + setFixedWidth(580); + QVBoxLayout* layout = new QVBoxLayout(mFormWidget); + layout->setSpacing(20); + setWindowFlags (Qt :: FramelessWindowHint | Qt :: Dialog); + mFormWidget->setObjectName("StopScanLoading"); + mFormWidget->setFixedSize(560,320); + + QLabel* loadingMessage = new QLabel(tr("Device is Stopping"), mFormWidget); + loadingMessage->setAlignment(Qt::AlignCenter); + layout->addWidget(loadingMessage); + mLoadingWidget->setColor("#0078d8"); + mLoadingWidget->setFixedHeight(48); + mLoadingWidget->setMaxDiameter(10); + mLoadingWidget->setMinDiameter(2); + mLoadingWidget->setCount(8); + layout->addWidget(mLoadingWidget); + layout->addItem(new QSpacerItem(20, 80, QSizePolicy::Fixed)); + + mLoadingWidget->setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_TranslucentBackground); + mBtnWidget->hide(); + setButtonMode(DialogButtonMode::None); + + mTimer->setSingleShot(true); + connect(mTimer, &QTimer::timeout, this, &QDialog::accept); +} + +StopScanLoadingDialog::~StopScanLoadingDialog() +{ + +} + +void StopScanLoadingDialog::showEvent(QShowEvent *aEvent) +{ + mTimer->start(LOADING_TIME); + GUIFormBaseDialog::showEvent(aEvent); +} + + diff --git a/src/dialogs/StopScanLoadingDialog.h b/src/dialogs/StopScanLoadingDialog.h new file mode 100644 index 0000000..36cbbed --- /dev/null +++ b/src/dialogs/StopScanLoadingDialog.h @@ -0,0 +1,25 @@ +#ifndef STOPSCANLOADINGDIALOG_H +#define STOPSCANLOADINGDIALOG_H + +#include "GUIFormBaseDialog.h" + +class LoadingWidget; +class QTimer; + +class StopScanLoadingDialog : public GUIFormBaseDialog +{ + Q_OBJECT +public: + StopScanLoadingDialog(QWidget* aParent = nullptr, Qt::WindowFlags aFlag = Qt::WindowFlags()); + ~StopScanLoadingDialog() override; + +protected: + void showEvent(QShowEvent *aEvent) override; + +private: + LoadingWidget* mLoadingWidget; + QTimer* mTimer; + +}; + +#endif // STOPSCANLOADINGDIALOG_H diff --git a/src/stylesheet/Dark2.css b/src/stylesheet/Dark2.css index d2fd6fd..709022d 100644 --- a/src/stylesheet/Dark2.css +++ b/src/stylesheet/Dark2.css @@ -1248,6 +1248,27 @@ QWidget#formWidget QLabel#CEchoMessage{ font-size: 24px; } +QWidget#StopScanLoading { + background: qlineargradient(x1:0, + y1: 0, + x2: 0, + y2: 1, + stop: 0.0 darkgray, + stop: 0.5 lightgray, + stop: 1.0 darkgray); + border-radius: 20px; + border: 5px solid #0078d8; + +} + +QWidget#StopScanLoading QLabel +{ + font-size: 30px; + font-weight: Bold; + color: #3078d8; +} + + diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts index 8403397..a0dbc7f 100644 --- a/src/translations/en_US.ts +++ b/src/translations/en_US.ts @@ -1864,6 +1864,13 @@ The emergency button has been pushed. Please reset it before other operations. + + StopScanLoadingDialog + + Device is Stopping + + + SystemCorrectionForm diff --git a/src/translations/zh_CN.ts b/src/translations/zh_CN.ts index f0f6190..63aa181 100644 --- a/src/translations/zh_CN.ts +++ b/src/translations/zh_CN.ts @@ -97,7 +97,7 @@ AccessionInformation - + Position 检查身侧 @@ -471,7 +471,7 @@ - + DMS connection error DMS失去连接 @@ -503,7 +503,7 @@ progress:99% 初始化失败 - + Fail to connect to DB!Reboot device to try! 数据库连接失败,请重启设备后再试! @@ -560,56 +560,56 @@ After lying down, click the confirm buttonto start scanning on the next side.关机失败,请按紧急按钮进行关机。 - - - + + + Scan data transfer failed. 扫查数据上传失败 - + Scan data transfer Succeeded! - + Create empty scan data failed 空水数据新增失败 - + Create scan data failed 扫查数据新增失败 - + Recon disconnected. 重建服务器已断开连接 - - + + Open pump failed. 排水阀打开失败 - + Recon error, can't start scan process 重建服务器错误,无法开始检查流程 - - + + Start auto locate failed 自动化定位启动失败 - + The data quality is low, please restart the data scan. 扫查数据质量较低,请重新开始检查流程 - + Device reset failed, please contact maintenance person 设备复位失败,请联系维修人员 @@ -629,12 +629,12 @@ After lying down, click the confirm buttonto start scanning on the next side.过去7天 - + The left emergency button has been pressed. Please reset left the emergency button before operating the device 检查对象左侧急停按钮被按下,请将左侧急停按钮复位后,再进行设备操作 - + The right emergency button has been pressed. Please reset right the emergency button before operating the device 检查对象右侧急停按钮被按下,请将右侧急停按钮复位后,再进行设备操作 @@ -847,24 +847,24 @@ After lying down, click the confirm buttonto start scanning on the next side. - - + + Stop 停止 - - + + OK 确认 - + Cancel 取消 - + Confirm stop the scan. 请确认是否停止扫查? @@ -2583,80 +2583,80 @@ parameters - + Worklist 在线 - - + + Add 新增 - - + + Edit 编辑 - + Patient Information Manage 检查对象信息录入 - + Local 本地 - - + + Delete 删除 - - + + Pull 拉取 - - + + Select 选择 - + Can't delete selected Patient ! 不能删除已经被选择的对象 - - + + Alert - + Delete Patient "%1" ? 删除检查对象"%1"? - + Confirm 确认 - + Can't delete selected Patient , db submit error! - + ID 检查对象ID @@ -2665,32 +2665,32 @@ parameters 检查单号 - - + + Name 姓名 - - + + Birth Date 出生日期 - - + + Gender 性别 - - + + Add Date 添加日期 - - + + Comment 备注 @@ -2842,6 +2842,14 @@ parameters 稍后开始 + + StopScanLoadingDialog + + + Device is Stopping + 设备正在停止扫查 + + SystemCorrectionForm @@ -3063,12 +3071,12 @@ parameters UsctStateManager - + Recon fatal error. 重建服务器致命错误 - + Recon DB error. 重建服务器数据库错误