From 1a722ee5219dc2852604ac1e7cd5b9c1776b3b7d Mon Sep 17 00:00:00 2001 From: sunwen Date: Fri, 24 May 2024 15:17:20 +0800 Subject: [PATCH] refactor: Protocals text and update tanslate text. --- src/dialogs/DialogManager.cpp | 5 +- src/dialogs/StartScanProcessDialog.cpp | 26 +- src/forms/settings/GeneralForm.cpp | 59 +-- src/json/jsonobject.cpp | 8 +- src/json/jsonobject.h | 6 +- src/translations/en_US.ts | 157 ++++++- src/translations/zh_CN.ts | 560 ++++++++++++++++--------- src/utilities/GetProtocalHelper.cpp | 72 ++++ src/utilities/GetProtocalHelper.h | 22 + 9 files changed, 633 insertions(+), 282 deletions(-) create mode 100644 src/utilities/GetProtocalHelper.cpp create mode 100644 src/utilities/GetProtocalHelper.h diff --git a/src/dialogs/DialogManager.cpp b/src/dialogs/DialogManager.cpp index 9e4b58a..5a29d29 100644 --- a/src/dialogs/DialogManager.cpp +++ b/src/dialogs/DialogManager.cpp @@ -34,6 +34,7 @@ #include "windows/LoginDialog.h" #include "screensaver/ScreenSaverWindow.h" #include "utilities/GetLockScreenTimeHelper.h" +#include "utilities/GetProtocalHelper.h" #include "appvals/AppGlobalValues.h" #include "json/jsonobject.h" @@ -243,8 +244,8 @@ DialogResult DialogManager::requestSelectProtocal() SelectDialog dialog(mTopWidget); setTopWidget(&dialog); dialog.setWindowModality(Qt::WindowModal); - dialog.setValues(JsonObject::Instance()->protocals()); - dialog.setSelectedValue(JsonObject::Instance()->defaultProtocal()); + dialog.setValues(GetProtocalHelper::getProtocalList()); + dialog.setSelectedValue(GetProtocalHelper::getProtocalStr()); int ret = dialog.exec(); releaseTopWidget(&dialog); return DialogResult(ret,dialog.getSelectedValue()); diff --git a/src/dialogs/StartScanProcessDialog.cpp b/src/dialogs/StartScanProcessDialog.cpp index 2e2a227..c8ec180 100644 --- a/src/dialogs/StartScanProcessDialog.cpp +++ b/src/dialogs/StartScanProcessDialog.cpp @@ -4,6 +4,8 @@ #include "forms/select/PatientInformation.h" #include "json/jsonobject.h" +#include "utilities/GetProtocalHelper.h" + #include StartScanProcessDialog::StartScanProcessDialog(QWidget *aParent) : @@ -35,26 +37,28 @@ void StartScanProcessDialog::initButtons() buttonGroup->addButton(mUI->mOnlyLeftButton, LONE); buttonGroup->addButton(mUI->mOnlyRightButton, RONE); - QString protocol = JsonObject::Instance()->defaultProtocal(); - if(protocol == "LSTAND") + int protocol = GetProtocalHelper::getProtocal(); + switch (protocol) { + case LSTAND: mUI->mLeftToRightButton->setChecked(true); mScanProtocal = LSTAND; - } - else if(protocol == "RSTAND") - { + break; + case RSTAND: mUI->mRightToLeftButton->setChecked(true); mScanProtocal = RSTAND; - } - else if(protocol == "LONE") - { + break; + case LONE: mUI->mOnlyLeftButton->setChecked(true); mScanProtocal = LONE; - } - else - { + break; + case RONE: mUI->mOnlyRightButton->setChecked(true); mScanProtocal = RONE; + break; + default: + mUI->mLeftToRightButton->setChecked(true); + mScanProtocal = LSTAND; } } diff --git a/src/forms/settings/GeneralForm.cpp b/src/forms/settings/GeneralForm.cpp index f45aa3c..83f7919 100644 --- a/src/forms/settings/GeneralForm.cpp +++ b/src/forms/settings/GeneralForm.cpp @@ -21,36 +21,7 @@ #include "log/UserOperationLog.h" #include "utilities/DiskInfoWorker.h" #include "utilities/GetLockScreenTimeHelper.h" - -namespace -{ - const int MINIMUM_LOCKTIME = 30; - - QString toTimeString(int aSeconds) - { - if(aSeconds == 0) - { - return "-"; - } - - if(aSeconds < 3600) - { - return QString("%1%2%3 %4%5%6 ").arg(QString::number((aSeconds % 3600) / 600)) - .arg(QString::number((aSeconds % 600) / 60)) - .arg(QObject::tr("Min")) - .arg(QString::number((aSeconds % 60) / 10)) - .arg(QString::number(aSeconds % 10)) - .arg(QObject::tr("Sec")); - } - - return QString("%1%2%3 %4%5%6 ").arg(QString::number(aSeconds / 36000)) - .arg(QString::number((aSeconds / 3600) % 10)) - .arg(QObject::tr("Hour")) - .arg(QString::number((aSeconds % 3600) / 600)) - .arg(QString::number((aSeconds % 600) / 60)) - .arg(QObject::tr("Min")); - } -} +#include "utilities/GetProtocalHelper.h" GeneralForm::GeneralForm(QWidget* aParent) : QWidget(aParent) @@ -114,7 +85,7 @@ GeneralForm::GeneralForm(QWidget* aParent) scanProtocalHeaderLayout->addWidget(scanProtocolLabel); scanProtocalHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding)); ListBox* scanProtocolButton = new ListBox(scanProtocolHeader); - scanProtocolButton->setText(tr(JsonObject::Instance()->defaultProtocal().toStdString().c_str())); + scanProtocolButton->setText(GetProtocalHelper::getProtocalStr()); scanProtocalHeaderLayout->addWidget(scanProtocolButton); scanProtocalHeaderLayout->addSpacerItem(new QSpacerItem(1220, 20, QSizePolicy::Fixed)); @@ -201,8 +172,6 @@ GeneralForm::GeneralForm(QWidget* aParent) }); connect(lockTime, &QToolButton::clicked, [=]() { - //take effect - //int second = JsonObject::Instance()->lockScreenTimeout().toInt(); DialogResult result = DialogManager::Default()->requestSelectLockScreenTime(); if (result.ResultCode == false) { @@ -211,24 +180,6 @@ GeneralForm::GeneralForm(QWidget* aParent) QString lockTimeStr = result.ResultData.toString(); lockTime->setText(lockTimeStr); GetLockScreenTimeHelper::setLockScreenTime(lockTimeStr); - //second = result.ResultData.toInt(); - //LOG_USER_OPERATION(QString("Set Screen Lock Time to %1 seconds").arg(second)) -// if(second == 0) -// { -// JsonObject::Instance()->setLockScreenTimeout(QString::number(second)); -// lockTime->setText(toTimeString(second)); -// Locker::getInstance()->setTimer(-1); -// Locker::getInstance()->setIsEnable(false); -// return; -// } - -// if (MINIMUM_LOCKTIME < second) -// { -// JsonObject::Instance()->setLockScreenTimeout(QString::number(second)); -// Locker::getInstance()->setTimer(second * 1000); -// Locker::getInstance()->setIsEnable(true); -// lockTime->setText(toTimeString(second)); -// } }); @@ -259,7 +210,7 @@ GeneralForm::GeneralForm(QWidget* aParent) screenSaverLabel->setText(tr("Screen Saver")); diskLabel->setText(tr("Disk Storage")); anonyButton->setChecked(JsonObject::Instance()->getAnonymousMode()); - scanProtocolButton->setText(tr(JsonObject::Instance()->defaultProtocal().toStdString().c_str())); + scanProtocolButton->setText(GetProtocalHelper::getProtocalStr()); updateStorageSize(); updateStorageUsed(); }); @@ -280,8 +231,8 @@ GeneralForm::GeneralForm(QWidget* aParent) { QString pro = result.ResultData.toString(); //take effect - JsonObject::Instance()->setDefaultProtocal(pro); - scanProtocolButton->setText(tr(JsonObject::Instance()->defaultProtocal().toStdString().c_str())); + GetProtocalHelper::setProtocal(pro); + scanProtocolButton->setText(GetProtocalHelper::getProtocalStr()); } }); diff --git a/src/json/jsonobject.cpp b/src/json/jsonobject.cpp index 4517b09..731d5d1 100644 --- a/src/json/jsonobject.cpp +++ b/src/json/jsonobject.cpp @@ -34,7 +34,7 @@ void JsonObject::init() mProtocalList = QString::fromLocal8Bit(QByteArray::fromRawData(protocals.c_str(), protocals.size())).split(";"); } - mDefaultProtocal = getJsonString("protocol", "default"); + mDefaultProtocal = QString(getJsonString("protocol", "default")).toInt(); first = cJSON_GetObjectItem((cJSON*)json_root, "general"); second = cJSON_GetObjectItem(first, "lockScreenTimes"); @@ -236,14 +236,14 @@ QStringList JsonObject::protocals() return mProtocalList; } -QString JsonObject::defaultProtocal() +int JsonObject::defaultProtocal() { return mDefaultProtocal; } -void JsonObject::setDefaultProtocal(const QString& str) +void JsonObject::setDefaultProtocal(int str) { - setJsonString("protocol", "default", str.toStdString().c_str()); + setJsonString("protocol", "default", QString::number(str).toStdString().c_str()); mDefaultProtocal = str; } diff --git a/src/json/jsonobject.h b/src/json/jsonobject.h index 22aaef4..6dc66d4 100644 --- a/src/json/jsonobject.h +++ b/src/json/jsonobject.h @@ -66,8 +66,8 @@ public: QStringList protocals(); - QString defaultProtocal(); - void setDefaultProtocal(const QString& str); + int defaultProtocal(); + void setDefaultProtocal(int str); QStringList lockScreenTimes(); @@ -155,7 +155,6 @@ private: QString mDefaultLanguage; QString mInstitutionName; QString mInstitutionAddr; - QString mDefaultProtocal; QString mInterfaceName; QString mGateway; @@ -166,6 +165,7 @@ private: QStringList mScreenSaverInfoList; int mLockScreenTime; + int mDefaultProtocal; int mOperationLogExpireDays; int mPatientListExpireDays; diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts index 1c99718..bb555c6 100644 --- a/src/translations/en_US.ts +++ b/src/translations/en_US.ts @@ -90,10 +90,6 @@ Logout - - Reset password to "123456" ? - - Inner error, can't find reference user! @@ -150,6 +146,22 @@ Input User name + + Do you want to logout the current user? + + + + Confirm Password + + + + Password and confirm password do not match! + + + + Reset to default password? + + AccountTableForm @@ -256,11 +268,6 @@ DeviceManager - - Patient can leave. - - - Data is currently being transmitted, please shut down later. @@ -281,6 +288,36 @@ Initialize Failed. + + Start auto locate failed + + + + DMS connection error + + + + Dms connection error + + + + The data quality is low, please restart the data scan. + + + + progress:%1% + + + + Patient can leave. +progress:%1% + + + + Data quality assessment in progress +progress:99% + + DicomCfgDialog @@ -339,10 +376,6 @@ Form - - AE - - Server Ip @@ -355,6 +388,10 @@ Server Port + + Local AE + + EditPatientDialog @@ -609,6 +646,18 @@ Subnet Mask + + Ip Address is not valid + + + + Subnet Mask is not valid + + + + Gateway is not valid + + Keyboard @@ -850,6 +899,18 @@ Shut down failed, please push emergency button to shutdown. + + Please execute the empty scan, assist with system calibration, when empty scan is completed, the system should operate normally. + + + + Warning + + + + There are %1 days left until the next empty scan. Please remind users to conduct the empty scan in time. + + MppsSettingsDialog @@ -1109,19 +1170,47 @@ Patient ID: ID: + + RSTAND + + + + LSTAND + + + + LONE + + + + RONE + + QObject - Min + Never - Sec + Minutes - Hour + LeftToRight + + + + RightToLeft + + + + Left + + + + Right @@ -1288,6 +1377,26 @@ Shut Down + + Stop Scan Process + + + + Left side scan initiated, auto positioning in progress. + + + + Right side scan initiated, auto positioning in progress. + + + + Data scanning, please keep the current position and don't move. + + + + Data exporting, patient can leave the holder + + ScanSearchCriteriaForm @@ -1637,6 +1746,22 @@ Log Date: + + Operation Date + + + + Operation Time + + + + User + + + + Operation + + WarningMessageWidget diff --git a/src/translations/zh_CN.ts b/src/translations/zh_CN.ts index cde7788..5c152a2 100644 --- a/src/translations/zh_CN.ts +++ b/src/translations/zh_CN.ts @@ -97,42 +97,53 @@ AccountFormDialog - + Account 账户 - + User ID 用户ID - + Input User ID 输入用户ID - + Name 姓名 - + + Reset to default password? + 重置为默认密码? + + + Input User name 输入用户名 - + + Do you want to logout the current user? + 是否确定要退出当前用户? + + + Password 密码 - + Change Password 修改密码 - + + Input password 输入密码 @@ -145,12 +156,13 @@ 重置密码 - + Reset Password 密码重置 - + + Logout 登出 @@ -163,55 +175,60 @@ 医生 - - Reset password to "123456" ? - 密码重置为"123456"? - - - + Inner error, can't find reference user! 内部错误! - - + + Submit change to database fail! 修改提交至数据库失败! - + Comment 备注 - - - + + Confirm Password + 确认密码 + + + + + User Name can't be empty! 用户名不能为空! - + User ID can't be empty! 用户ID不能为空! - + Password can't be empty! 密码不能为空! - + + Password and confirm password do not match! + 密码和确认密码不一致 + + + Inner error ,unset data model! 内部错误! - + User Id exists! 用户ID已存在! - + Submit to data base fail! 提交至数据库失败! @@ -331,7 +348,7 @@ Warning - + 警告 @@ -347,37 +364,37 @@ 当前密码 - + New Password 新密码 - + Confirm Password 确认密码 - + Please enter your old password! 请输入旧密码! - + New password should at least 6 characters! 新密码至少6位字符! - + Wrong password! 密码错误! - + Your new password does not match! 新密码不匹配! - + Database update error! 数据库更新错误! @@ -393,37 +410,71 @@ DeviceManager - + + DMS connection error + + + + + progress:%1% + 进度:%1% + + + Patient can leave. - - +progress:%1% + 检查对象可以离开检查仓 +进度:%1% - + + Data quality assessment in progress +progress:99% + 数据质量判断中 +进度:99% + + + Initialize Failed. - + 初始化失败 - + Data is currently being transmitted, please shut down later. - + Shut down failed, please push emergency button to shutdown. - + Recon disconnected. - - + + Open pump failed. + + + + Start auto locate failed + 自动化定位启动失败 + + + + The data quality is low, please restart the data scan. + 扫查数据质量较低,请重新开始检查流程 + + + + Dms connection error + + DicomCfgDialog @@ -507,8 +558,8 @@ - AE - AE + Local AE + 本机AE @@ -641,56 +692,56 @@ GeneralForm - - + + Language 语言 - + Institution Name 机构名称 - - - + + + Institution Addr 机构地址 - - + + Lock Screen 锁屏时间 - - + + Scan Protocol 默认检查协议 - - + + Anonymous Mode 匿名模式 - - + + Screen Saver 屏保 - - + + Complete Notify 检查结束确认 - - + + Disk Storage 磁盘存储 @@ -699,22 +750,22 @@ 中文 - + Used: %1G - + Total: %1G - + Get disk used size fail! 磁盘使用空间获取失败! - + Get disk total size fail! 磁盘总空间获取失败! @@ -807,33 +858,33 @@ GetWorkListDialog - + Accession Nummber - + 检查单号 - - + + Patient ID 检查对象ID - + Accession Number 检查单号 - + Accession Number and Patient Id is Empty. - + Unknow Error. code:001001001 - + DB Error,Patient Write Failed @@ -849,22 +900,37 @@ IpSettingsDialog - + + Ip Address is not valid + IP地址不符合格式规范 + + + + Subnet Mask is not valid + 子网掩码不符合格式规范 + + + + Gateway is not valid + 网关地址不符合格式规范 + + + IP Settings 设备IP设置 - + IP Address IP地址 - + Subnet Mask 子网掩码 - + Gateway 网关 @@ -1115,22 +1181,22 @@ Can't connect db. Please reboot the device and retry, or call for the service help. - + 数据库连接失败,无法登录,请重启设备后再试 Login locked. Please retry after %1 minutes. - + 登录锁定,请在1分钟后重试 Login failed, username or password error! Remaining retries: %1 - + 登录失败,用户名或密码错误,重试次数: %1 Anonymous Mode active! - + 匿名模式开启 @@ -1165,25 +1231,41 @@ - - + + Select 选择 - - + + Scan 扫描 - - + + Recon 重建 - + + Please execute the empty scan, assist with system calibration, when empty scan is completed, the system should operate normally. + 请先进行空水扫查,辅助系统校正,空水扫查结束后,系统正常运行。 + + + + + Warning + 警告 + + + + There are %1 days left until the next empty scan. Please remind users to conduct the empty scan in time. + 距离下次空水扫查还有%1天,请用户及时进行空水扫查。 + + + Shut down failed, please push emergency button to shutdown. @@ -1200,8 +1282,8 @@ 管理 - - + + Settings 设置 @@ -1222,32 +1304,32 @@ Mpps通讯设置 - + AE can't be empty AE不能为空 - + Server AE can't be empty 服务器AE不能为空 - + Server Ip can't be empty 服务器地址不能为空 - + Server Port can't be empty 服务器端口不能为空 - + Ip Address is not valid 服务器地址不符合格式规范 - + Port is not valid 服务器端口格式必须为小于65535的数字 @@ -1571,24 +1653,63 @@ Scan Protocol: 检查身侧: + + + RSTAND + 从右至左 + + + + LSTAND + 从左至右 + + + + LONE + 单侧左 + + + + RONE + 单侧右 + QObject - - - Min - + + Never + 从不 - - Sec - + + Minutes + 分钟 - - Hour - + + + + + LeftToRight + 左->右 + + + + + RightToLeft + 右->左 + + + + + Left + 单侧左 + + + + Right + 单侧右 @@ -1763,69 +1884,96 @@ 空扫 - - - - + + + + Drainage 排水 - - + + Account 账户 - - + + ShutDown 关机 - - + + Worklist 录入检查对象 - - + + + Start Scan 开始检查流程 - + Make sure to open the drain valve ? - + Confirm Drainage - - - + + + Drainaging 排水中 - + Shut down now ? - 是否立即执行关机操作? + 是否需要进行设备关机操作,请确认? - + Shut Down 关机 - + + Please confirm checking patient information to start the process 请确定检查对象信息开始流程 + + + Data scanning, please keep the current position and don't move. + 数据扫查中,请检查对象保持当前姿势,不要移动 + + + + Data exporting, patient can leave the holder + 数据导出中,检查对象可以离开检查仓 + + + + Left side scan initiated, auto positioning in progress. + 左侧扫查启动,自动定位中 + + + + Right side scan initiated, auto positioning in progress. + 右侧扫查启动,自动定位中 + + + + Stop Scan Process + 退出检查流程 + some settings @@ -1943,14 +2091,14 @@ parameters 新增(拉取) - - + + Add 新增 - - + + Edit 编辑 @@ -1960,81 +2108,81 @@ parameters 检查对象信息录入 - - + + Delete 删除 - - + + Select 选择 - + Can't delete selected Patient ! 不能删除已经被选择的对象 - - + + Alert - + Delete Patient "%1" ? - + Confirm - + Can't delete selected Patient , db submit error! - + ID 检查对象ID - - + + AccessionNumber 检查单号 - - + + Name 姓名 - - + + Birth Date 出生日期 - - + + Gender 性别 - - + + Add Date 添加日期 - - + + Comment 备注 @@ -2042,14 +2190,14 @@ parameters SettingFormWidget - - + + General 通用设置 - - + + Account 用户管理 @@ -2058,33 +2206,33 @@ parameters 系统 - - + + About 关于 - - + + Network Settings 网络通讯设置 - - + + Operation Log 系统操作日志 - - + + System Correction 系统校正 - - - + + + Help 帮助 @@ -2182,54 +2330,58 @@ parameters SystemCorrectionForm - - + + Scan Preparation 扫查准备 - - + + Empty Scan 空水扫描 - - + + 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. 空水扫描是采集空水时的超声数据,需确保检查仓内部装满水且无物体时执行。空水数据是为了获取超声在检查仓内部传播的时间和能量的变化基准信息,用于重建透射超声图像的参考数据。另一方面,空水数据也可给系统状态的判断和系统的空间校正提供数据支持,故空水扫描需隔一个月定期执行。 - - + + + Current date for Empty Scanning %1-%2-%3 当前空水数据扫描时间 %1年%2月%3日 - + + %1-%2-%3 %1年%2月%3日 - - + + + Expiration date for Empty Scanning %1 当前空水数据有效期限%1 - + + Excute empty scan 执行空水扫描 - + Please make sure the holder is only contain water! - + 请确认Holder中已灌满水,并没有其他物体的情况下再启动空水扫描 - + Confirm Scan - + 扫查确认 @@ -2339,6 +2491,30 @@ parameters Log Date: 日志时间 + + + + Operation Date + 操作日期 + + + + + Operation Time + 操作时间 + + + + + User + 用户 + + + + + Operation + 操作内容 + WarningMessageWidget @@ -2354,13 +2530,13 @@ parameters - + System Status - + System Notifications @@ -2375,7 +2551,7 @@ parameters Worklist Settings - Worklist + Worklist通讯设置 diff --git a/src/utilities/GetProtocalHelper.cpp b/src/utilities/GetProtocalHelper.cpp new file mode 100644 index 0000000..ef7167c --- /dev/null +++ b/src/utilities/GetProtocalHelper.cpp @@ -0,0 +1,72 @@ +#include "GetProtocalHelper.h" + +#include "json/jsonobject.h" + +#include + +QStringList GetProtocalHelper::getProtocalList() +{ + QStringList protocalList = JsonObject::Instance()->protocals(); + QStringList result; + foreach(QString protocal, protocalList) + { + result << switchProtocalIntToProtocalString(protocal.toInt()); + } + return result; +} + +int GetProtocalHelper::getProtocal() +{ + return JsonObject::Instance()->defaultProtocal(); +} + +QString GetProtocalHelper::getProtocalStr() +{ + return switchProtocalIntToProtocalString(getProtocal()); +} + +void GetProtocalHelper::setProtocal(const QString& aProtocal) +{ + JsonObject::Instance()->setDefaultProtocal(switchProtocalStringToProtocalInt(aProtocal)); +} + +QString GetProtocalHelper::switchProtocalIntToProtocalString(int aProtocal) +{ + switch(aProtocal) + { + case 0 : + return QObject::tr("LeftToRight"); + case 1 : + return QObject::tr("RightToLeft"); + case 2 : + return QObject::tr("Left"); + case 3 : + return QObject::tr("Right"); + default: + return QObject::tr("LeftToRight"); + } +} + +int GetProtocalHelper::switchProtocalStringToProtocalInt(const QString& aPortocal) +{ + if(aPortocal == QObject::tr("LeftToRight")) + { + return 0; + } + else if(aPortocal == QObject::tr("RightToLeft")) + { + return 1; + } + else if(aPortocal == QObject::tr("Left")) + { + return 2; + } + else if(aPortocal == QObject::tr("LeftToRight")) + { + return 3; + } + else + { + return 0; + } +} diff --git a/src/utilities/GetProtocalHelper.h b/src/utilities/GetProtocalHelper.h new file mode 100644 index 0000000..7da0634 --- /dev/null +++ b/src/utilities/GetProtocalHelper.h @@ -0,0 +1,22 @@ +#ifndef GETPROTOCALHELPER_H +#define GETPROTOCALHELPER_H + + +#include + +class GetProtocalHelper +{ +public: + GetProtocalHelper() = delete ; + + static QStringList getProtocalList(); + static QString getProtocalStr(); + static int getProtocal(); + static void setProtocal(const QString& aPortocal); + +private: + static QString switchProtocalIntToProtocalString(int aPortocal); + static int switchProtocalStringToProtocalInt(const QString& aPortocal); +}; + +#endif // GETPROTOCALHELPER_H