From 50ef2b66bff54093f7b56ee12db8c4d04c35b3cf Mon Sep 17 00:00:00 2001 From: xueyan hu <576627988@qq.com> Date: Tue, 21 Dec 2021 16:46:47 +0800 Subject: [PATCH] temp --- src/generalform.cpp | 39 +++++++++++++-------------- src/generalform.h | 11 +------- src/systemsettingform.cpp | 6 +++++ src/translations/en_US.ts | 32 +++++++++++++++------- src/translations/zh_CN.qm | Bin 2554 -> 3194 bytes src/translations/zh_CN.ts | 54 +++++++++++++++++++++++--------------- 6 files changed, 80 insertions(+), 62 deletions(-) diff --git a/src/generalform.cpp b/src/generalform.cpp index 6080737..18ea551 100644 --- a/src/generalform.cpp +++ b/src/generalform.cpp @@ -14,6 +14,7 @@ #include "locker.h" #include "languageswitcher.h" +#include "event/EventCenter.h" GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) { @@ -22,7 +23,7 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) layout->addWidget(lanHeader); QHBoxLayout* lanHeaderLayout = new QHBoxLayout(lanHeader); - lbl_lan = new QLabel(tr("Language")); + QLabel* lbl_lan = new QLabel(tr("Language")); lanHeaderLayout->addWidget(lbl_lan); QPushButton* btnLan = new QPushButton(lanHeader); @@ -32,12 +33,15 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) QWidget* instHeader = new QWidget(this); layout->addWidget(instHeader); QHBoxLayout* instHeaderLayout = new QHBoxLayout(instHeader); - instHeaderLayout->addWidget(new QLabel(tr("Institution Name"))); + QLabel* lbl_ins = new QLabel(tr("Institution Name")); + instHeaderLayout->addWidget(lbl_ins); QLineEdit* instName = new QLineEdit(instHeader); instName->setMaximumSize(QSize(300, 32768)); instHeaderLayout->addWidget(instName); instHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed)); - instHeaderLayout->addWidget(new QLabel(tr("Institution Addr"))); + + QLabel* lbl_insaddr = new QLabel(tr("Institution Addr")); + instHeaderLayout->addWidget(lbl_insaddr); QLineEdit* instAddr = new QLineEdit(instHeader); instHeaderLayout->addWidget(instAddr); instAddr->setMaximumSize(QSize(300, 32768)); @@ -46,7 +50,10 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) QWidget* lockHeader = new QWidget(this); layout->addWidget(lockHeader); QHBoxLayout* lockHeaderLayout = new QHBoxLayout(lockHeader); - lockHeaderLayout->addWidget(new QLabel(tr("Lock Screen Timeout"))); + + QLabel* lbl_lock = new QLabel(tr("Lock Screen Timeout")); + lockHeaderLayout->addWidget(lbl_lock); + QLineEdit* lockTime = new QLineEdit(lockHeader); lockTime->setMaximumSize(QSize(300, 32768)); lockHeaderLayout->addWidget(lockTime); @@ -95,24 +102,14 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) LanguageSwitcher::Instance()->setDefaultLanguage(lan); btnLan->setText(JsonObject::Instance()->defaultLanguage()); - EventCenter::Default()->triggerEvent(ReloadLanguage, nullptr,nullptr); + EventCenter::Default()->triggerEvent(ReloadLanguage, nullptr, nullptr); } }); -} -void GeneralForm::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - //this->retranslateUi(); + connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { lbl_lan->setText(tr("Language")); - } -} - -void GeneralForm::retranslateUi() -{ - - //lbl_lan->setText(QApplication::translate("GeneralForm", "Language", nullptr)); - lbl_lan->setText(tr("Language")); - -} // retranslateUi \ No newline at end of file + lbl_ins->setText(tr("Institution Addr")); + lbl_insaddr->setText(tr("Institution Addr")); + lbl_lock->setText(tr("Lock Screen Timeout")); + }); +} \ No newline at end of file diff --git a/src/generalform.h b/src/generalform.h index 385cd25..290c60f 100644 --- a/src/generalform.h +++ b/src/generalform.h @@ -5,7 +5,7 @@ class QPushButton; class QVBoxLayout; class SelectDialog; -class QLabel; + class GeneralForm : public QWidget { @@ -13,18 +13,9 @@ class GeneralForm : public QWidget public: explicit GeneralForm(QWidget* parent = nullptr); -signals: - -public slots: -protected: - void changeEvent(QEvent* event); - private: - void retranslateUi(); QVBoxLayout* layout = nullptr; SelectDialog* dialog = nullptr; - - QLabel* lbl_lan = nullptr; }; #endif // GENERALFORM_H \ No newline at end of file diff --git a/src/systemsettingform.cpp b/src/systemsettingform.cpp index 03b275c..12ca75c 100644 --- a/src/systemsettingform.cpp +++ b/src/systemsettingform.cpp @@ -14,6 +14,8 @@ #include "components/imageswitch.h" #include "network/networkcfgdialog.h" #include "network/getadminpsw.h" + +#include "event/EventCenter.h" systemSettingForm::systemSettingForm(QWidget* parent) : QWidget(parent), ui(new Ui::systemSettingForm) @@ -100,6 +102,10 @@ systemSettingForm::systemSettingForm(QWidget* parent) : ui->btnFlt->setText(JsonObject::Instance()->defaultFilter()); } }); + + connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { + ui->retranslateUi(this); + }); } systemSettingForm::~systemSettingForm() diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts index aff392b..337f1d5 100644 --- a/src/translations/en_US.ts +++ b/src/translations/en_US.ts @@ -187,32 +187,40 @@ AdminSettingForm - + + General - + + Account Manage - + + System Setting - + + System Information - + + Operation Log - + + + + About @@ -1109,22 +1117,26 @@ GeneralForm - + + Language - + Institution Name - + + + Institution Addr - + + Lock Screen Timeout diff --git a/src/translations/zh_CN.qm b/src/translations/zh_CN.qm index 4ed9326a218e383943845f2295bc32e323443b08..e28e74a70303fc77b65eb273b2fbba978c19a6bf 100644 GIT binary patch delta 703 zcmew*{7YhjNa6|x29{6;26h`D{eXdi;~N8m`w}2qnSsG05y&@SVDLJ|z`$z6z_ObK zNY7$mxz-C5Kf}Q4+RVVf*~-A`VamY3umD0c9fQ!Eaty3xQ-Jd8C)z4VFs_?^2B;^J zapNT?Al=WTTYeoV=P@x=-!X+{hUXrj1J1In(OC+#fSKj|vZp})Usls+M}P(wu(r6I z1oEe__N*~sU|_Rmi`cCPj$maH^%ETFe4+3{e&^c?J-rj>RuAHx=j^ znaQc_f|G+dHLOt_!xG@=988=+0r^FfJ2+$~*Kr!TqL{%IP+FYfR9aF(Wax5)=NDz? OWEKNWlbO7k(;WcOV#Krn delta 198 zcmew*@k@Auh^7YvgZmN&1{P%o2Crib46H^BEW25N^ehHe4^svPh6NCs>Da_l1r8?N z^6Lx??6)Sa)i>m0nc=wy$SG%8qq7vKftls}vZp})a#qu4M}Qg&SX*390{M2VJ!?!D z7}%^Q%QD(AafnZjWz;m8 - + AbstractButtonSection @@ -191,32 +191,40 @@ AdminSettingForm - + + General 通用 - + + Account Manage 用户管理 - + + System Setting 系统设置 - + + System Information 系统信息 - + + Operation Log 操作日志 - + + + + About 关于 @@ -1113,22 +1121,26 @@ GeneralForm - + + Language 语言 - + Institution Name 机构名称 - + + + Institution Addr 机构地址 - + + Lock Screen Timeout 锁屏时间 @@ -2185,7 +2197,7 @@ Form - + @@ -2199,7 +2211,7 @@ PushButton - + @@ -2229,49 +2241,49 @@ IP - + Name - 姓名 + AE - + PACS - + 3D Recon - + Worklist - + DAQ - + Port - +