diff --git a/.gitignore b/.gitignore index 7fa4ac1..f337488 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ /out/ /.vs/ /CMakeSettings.json +/src/translations/*.ts +*.ts diff --git a/CMakeLists.txt b/CMakeLists.txt index aec5c3e..b868eb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,23 @@ file(GLOB project_uis ./src/*.ui) qt5_wrap_ui(ui_FILES ${project_uis}) file(GLOB project_res ./src/*.qrc) +#ADD_SUBDIRECTORY(./src/translations) +#set(TS_FILES +# ./src/translations/en_US.ts +# ./src/translations/zh_CN.ts) +#find_package(Qt5 COMPONENTS ${REQUIRED_LIBS} LinguistTools REQUIRED) +#qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) +#add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES} ${QM_FILES} ) + +#file(GLOB TS_FILES ./src/translations/*.ts) + +SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM TRUE) +#file(GLOB TS_FILES ./src/translations/*.ts) +set(TS_FILES + ./src/translations/en_US.ts + ./src/translations/zh_CN.ts) +find_package(Qt5 COMPONENTS ${REQUIRED_LIBS} LinguistTools REQUIRED) +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) set(TS_FILES src/translations/en_US.ts src/translations/zh_CN.ts) @@ -60,6 +77,7 @@ foreach(_file ${TS_FILES}) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${POWERSHELL_PATH} " cp -Force" ${_rfile} ${backup}) endforeach() +add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES} ${QM_FILES} ) if(UNIX AND USE_SHIMLIB) link_directories(/usr/local/lib64) target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard Qt5::Network pthread usct_shim dmapi log4c cunit ctomat hdf5 matio m) diff --git a/src/AccountFormDialog.cpp b/src/AccountFormDialog.cpp index 22ab957..be459c4 100644 --- a/src/AccountFormDialog.cpp +++ b/src/AccountFormDialog.cpp @@ -10,181 +10,181 @@ #include #include #include -#include -#include +#include "event/EventCenter.h" +#include "log/UserOperationLog.h" #include "db/SQLHelper.h" #include "models/User.h" #include "components/SlidePickerBox.h" #include "SelectDialog.h" #include "AlertDialog.h" -AccountFormDialog::AccountFormDialog(QWidget *parent,AccountEditMode mode, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) { - m_mode = mode; - QVBoxLayout* layout = new QVBoxLayout(formWidget); - layout->setSpacing(10); - // add title - QLabel* lbl_title = new QLabel(this); - lbl_title->setAlignment(Qt::AlignCenter); - lbl_title->setText(tr("Account")); - lbl_title->setObjectName("title"); - layout->addWidget(lbl_title); +AccountFormDialog::AccountFormDialog(QWidget* parent, AccountEditMode mode, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) { + m_mode = mode; + QVBoxLayout* layout = new QVBoxLayout(formWidget); + layout->setSpacing(10); + // add title + QLabel* lbl_title = new QLabel(this); + lbl_title->setAlignment(Qt::AlignCenter); + lbl_title->setText(tr("Account")); + lbl_title->setObjectName("title"); + layout->addWidget(lbl_title); - //add usercode - QLabel* lbl_UserCode = new QLabel(this); - lbl_UserCode->setText(tr("User ID")); - le_UserCode = new QLineEdit(this); - le_UserCode->setPlaceholderText(tr("Input User ID")); - if(m_mode != New)le_UserCode->setEnabled(false); - layout->addWidget(lbl_UserCode); - layout->addWidget(le_UserCode); - QLabel* lbl_endline1 = new QLabel(this); - lbl_endline1->setObjectName("endline"); - layout->addWidget(lbl_endline1); + //add usercode + QLabel* lbl_UserCode = new QLabel(this); + lbl_UserCode->setText(tr("User ID")); + le_UserCode = new QLineEdit(this); + le_UserCode->setPlaceholderText(tr("Input User ID")); + if (m_mode != New)le_UserCode->setEnabled(false); + layout->addWidget(lbl_UserCode); + layout->addWidget(le_UserCode); + QLabel* lbl_endline1 = new QLabel(this); + lbl_endline1->setObjectName("endline"); + layout->addWidget(lbl_endline1); - //add username - QLabel* lbl_UserName = new QLabel(this); - lbl_UserName->setText(tr("Name")); - le_UserName = new QLineEdit(this); - le_UserName->setPlaceholderText(tr("Input User name")); - layout->addWidget(lbl_UserName); - layout->addWidget(le_UserName); - QLabel* lbl_endline2 = new QLabel(this); - lbl_endline2->setObjectName("endline"); - layout->addWidget(lbl_endline2); + //add username + QLabel* lbl_UserName = new QLabel(this); + lbl_UserName->setText(tr("Name")); + le_UserName = new QLineEdit(this); + le_UserName->setPlaceholderText(tr("Input User name")); + layout->addWidget(lbl_UserName); + layout->addWidget(le_UserName); + QLabel* lbl_endline2 = new QLabel(this); + lbl_endline2->setObjectName("endline"); + layout->addWidget(lbl_endline2); - //add password - QLabel* lbl_Pwd = new QLabel(this); - lbl_Pwd->setText(tr("Password")); - layout->addWidget(lbl_Pwd); + //add password + QLabel* lbl_Pwd = new QLabel(this); + lbl_Pwd->setText(tr("Password")); + layout->addWidget(lbl_Pwd); - // add new mode - if (m_mode == New) - { - le_Pwd = new QLineEdit(this); - le_Pwd->setPlaceholderText(tr("Input password")); - le_Pwd->setEchoMode(QLineEdit::Password); - layout->addWidget(le_Pwd); - } else{//edit mode - btn_Pwd = new QPushButton(this); - btn_Pwd->setText(tr(m_mode==Self?"Change Password":"Reset Password")); - layout->addWidget(btn_Pwd); - } - QLabel* lbl_endline3 = new QLabel(this); - lbl_endline3->setObjectName("endline"); - layout->addWidget(lbl_endline3); + // add new mode + if (m_mode == New) + { + le_Pwd = new QLineEdit(this); + le_Pwd->setPlaceholderText(tr("Input password")); + le_Pwd->setEchoMode(QLineEdit::Password); + layout->addWidget(le_Pwd); + } + else {//edit mode + btn_Pwd = new QPushButton(this); + btn_Pwd->setText(tr(m_mode == Self ? "Change Password" : "Reset Password")); + layout->addWidget(btn_Pwd); + } + QLabel* lbl_endline3 = new QLabel(this); + lbl_endline3->setObjectName("endline"); + layout->addWidget(lbl_endline3); - if (m_mode == Self) - { - //add logout - QLabel* lbl_Logout = new QLabel(this); - lbl_Logout->setText(tr("Logout")); - QPushButton* btn_Logout= new QPushButton(this); - btn_Logout->setText(tr("Logout")); - layout->addWidget(lbl_Logout); - layout->addWidget(btn_Logout); - QLabel* lbl_endline0 = new QLabel(this); - lbl_endline0->setObjectName("endline"); - layout->addWidget(lbl_endline0); - // load current user data - if (User::Current()) - { - le_UserCode->setText(User::Current()->getUserCode()); - le_UserName->setText(User::Current()->getUserName()); - m_UserID = User::Current()->getUserID(); - m_UserPwd = User::Current()->getPassword(); - } - connect(btn_Pwd, &QPushButton::clicked,[t=this](){ - ChangePasswordFormDialog dia(t->parentWidget()); - dia.setWindowModality(Qt::WindowModal); - dia.exec(); - }); - connect(btn_Logout, &QAbstractButton::clicked, [=](){ - this->accept(); - LOG_USER_OPERATION(Logout); - EventCenter::Default()->triggerEvent(GUIEvents::RequestLogin, nullptr, nullptr); - }); - } - else - { - //add change role - QLabel* lbl_Role = new QLabel(this); - lbl_Role->setText(tr("Change Role")); - btn_Role= new QPushButton(this); - layout->addWidget(lbl_Role); - layout->addWidget(btn_Role); - QLabel* lbl_endline0 = new QLabel(this); - lbl_endline0->setObjectName("endline"); - layout->addWidget(lbl_endline0); - //set default value - if (m_mode == New) { - btn_Role->setText("doctor"); - m_RoleID = User::getRoleID("doctor"); - } - else{ - connect(btn_Pwd,&QAbstractButton::clicked,[=](){ - AlertDialog dialog(this); - dialog.setButtonMode(OkAndCancel); - dialog.setWindowModality(Qt::WindowModal); - dialog.setAlertMessage(tr("Reset password to \"123456\" ?")); - if (dialog.exec() == Accepted) - { - User user; - dialog.setButtonMode(OkOnly); - if (!User::getUser(m_UserID, user)) { - dialog.setAlertMessage(tr("Inner error, can't find reference user!")); - dialog.exec(); - return; - } - if (!user.resetPassword()) - { - dialog.setAlertMessage(tr("Submit change to database fail!")); - dialog.exec(); - } - } - }); - } - connect(btn_Role,&QAbstractButton::clicked,[=](){ - SelectDialog selectDialog(this); - selectDialog.setAvailableDates(User::getAllRoleName()); - selectDialog.setSelectedValue(btn_Role->text()); - selectDialog.setWindowModality(Qt::WindowModal); - // submit change - if (selectDialog.exec() == Accepted) - { - if (selectDialog.getSelectedValue() != btn_Role->text()) - { - QString newRoleID = User::getRoleID(selectDialog.getSelectedValue()); - btn_Role->setText(selectDialog.getSelectedValue()); - m_RoleID = newRoleID; - qDebug()<<"new Role ID:"<roleChanged = true; - } - } - }); - } + if (m_mode == Self) + { + //add logout + QLabel* lbl_Logout = new QLabel(this); + lbl_Logout->setText(tr("Logout")); + QPushButton* btn_Logout = new QPushButton(this); + btn_Logout->setText(tr("Logout")); + layout->addWidget(lbl_Logout); + layout->addWidget(btn_Logout); + QLabel* lbl_endline0 = new QLabel(this); + lbl_endline0->setObjectName("endline"); + layout->addWidget(lbl_endline0); + // load current user data + if (User::Current()) + { + le_UserCode->setText(User::Current()->getUserCode()); + le_UserName->setText(User::Current()->getUserName()); + m_UserID = User::Current()->getUserID(); + m_UserPwd = User::Current()->getPassword(); + } + connect(btn_Pwd, &QPushButton::clicked, [t = this]() { + ChangePasswordFormDialog dia(t->parentWidget()); + dia.setWindowModality(Qt::WindowModal); + dia.exec(); + }); + connect(btn_Logout, &QAbstractButton::clicked, [=]() { + this->accept(); + LOG_USER_OPERATION(Logout); + EventCenter::Default()->triggerEvent(GUIEvents::RequestLogin, nullptr, nullptr); + }); + } + else + { + //add change role + QLabel* lbl_Role = new QLabel(this); + lbl_Role->setText(tr("Change Role")); + btn_Role = new QPushButton(this); + layout->addWidget(lbl_Role); + layout->addWidget(btn_Role); + QLabel* lbl_endline0 = new QLabel(this); + lbl_endline0->setObjectName("endline"); + layout->addWidget(lbl_endline0); + //set default value + if (m_mode == New) { + btn_Role->setText(tr("doctor")); + m_RoleID = User::getRoleID("doctor"); + } + else { + connect(btn_Pwd, &QAbstractButton::clicked, [=]() { + AlertDialog dialog(this); + dialog.setButtonMode(OkAndCancel); + dialog.setWindowModality(Qt::WindowModal); + dialog.setAlertMessage(tr("Reset password to \"123456\" ?")); + if (dialog.exec() == Accepted) + { + User user; + dialog.setButtonMode(OkOnly); + if (!User::getUser(m_UserID, user)) { + dialog.setAlertMessage(tr("Inner error, can't find reference user!")); + dialog.exec(); + return; + } + if (!user.resetPassword()) + { + dialog.setAlertMessage(tr("Submit change to database fail!")); + dialog.exec(); + } + } + }); + } + connect(btn_Role, &QAbstractButton::clicked, [=]() { + SelectDialog selectDialog(this); + selectDialog.setAvailableDates(User::getAllRoleName()); + selectDialog.setSelectedValue(btn_Role->text()); + selectDialog.setWindowModality(Qt::WindowModal); + // submit change + if (selectDialog.exec() == Accepted) + { + if (selectDialog.getSelectedValue() != btn_Role->text()) + { + QString newRoleID = User::getRoleID(selectDialog.getSelectedValue()); + btn_Role->setText(selectDialog.getSelectedValue()); + m_RoleID = newRoleID; + qDebug() << "new Role ID:" << newRoleID; + this->roleChanged = true; + } + } + }); + } - //add Comment - QLabel* lbl_Comment = new QLabel(this); - lbl_Comment->setText(tr("Comment")); - le_Comment = new QLineEdit(this); - layout->addWidget(lbl_Comment); - layout->addWidget(le_Comment); - QLabel* lbl_endline0 = new QLabel(this); - lbl_endline0->setObjectName("endline"); - layout->addWidget(lbl_endline0); - - lbl_error = new QLabel(this); - lbl_error->setObjectName("warn"); - lbl_error->setVisible(false); - layout->addWidget(lbl_error); - connect(le_Comment, &QLineEdit::textChanged, [=](const QString& text){ - commentChanged = true; - }); - connect(le_UserName, &QLineEdit::textChanged, [=](const QString& text){ - m_NewUserName = text; - userNameChanged = true; - }); + //add Comment + QLabel* lbl_Comment = new QLabel(this); + lbl_Comment->setText(tr("Comment")); + le_Comment = new QLineEdit(this); + layout->addWidget(lbl_Comment); + layout->addWidget(le_Comment); + QLabel* lbl_endline0 = new QLabel(this); + lbl_endline0->setObjectName("endline"); + layout->addWidget(lbl_endline0); + lbl_error = new QLabel(this); + lbl_error->setObjectName("warn"); + lbl_error->setVisible(false); + layout->addWidget(lbl_error); + connect(le_Comment, &QLineEdit::textChanged, [=](const QString& text) { + commentChanged = true; + }); + connect(le_UserName, &QLineEdit::textChanged, [=](const QString& text) { + m_NewUserName = text; + userNameChanged = true; + }); } AccountFormDialog::~AccountFormDialog() { @@ -192,122 +192,125 @@ AccountFormDialog::~AccountFormDialog() { } bool AccountFormDialog::updateReferenceData() { - if (m_mode == Self) { - if (!this->userNameChanged && !this->commentChanged) return true; - if (!this->userNameChanged) { - if (m_NewUserName.isEmpty()){ - warn(tr("User Name can't be empty!")); - return false; - } - User::Current()->setUserName(m_NewUserName); - } - if (!this->commentChanged) User::Current()->setUserName(le_Comment->text()); - bool ret = User::Current()->submitChange(); - if (ret) { - hideWarn(); - LOG_USER_OPERATION(ChangeUserName); - } - else{ - warn(tr("Submit change to database fail!")); - } - return ret; - } else if (m_mode == Admin){ - if (!this->userNameChanged && !this->roleChanged) return true; - User user; - if (!User::getUser(m_UserID, user)) return true; - if (this->userNameChanged){ - if (m_NewUserName.isEmpty()){ - warn(tr("User Name can't be empty!")); - return false; - } - user.setUserName(m_NewUserName); - } - if (this->roleChanged) user.setRoleID(m_RoleID); - if (!this->commentChanged) user.setComment(le_Comment->text()); - bool ret = user.submitChange(); - if (ret) { - LOG_USER_OPERATION(AdminChangeAcountInformation); - } - return ret; - } else { - //add new - User user; - if (le_UserCode->text().isEmpty()) { - warn(tr("User ID can't be empty!")); - return false; - } - if (le_UserName->text().isEmpty()) { - warn(tr("User Name can't be empty!")); - return false; - } - if (le_Pwd->text().isEmpty()) { - warn(tr("Password can't be empty!")); - return false; - } - if (!refmodel){ - warn(tr("Inner error ,unset data model!")); - return false; - } - if (User::existsUser(le_UserCode->text())){ - warn(tr("User Id exists!")); - return false; - } - hideWarn(); - user.setUserName(le_UserName->text()); - user.setPassword(User::getEncryptedPassword(le_Pwd->text())); - user.setRoleID(m_RoleID); - user.setComment(le_Comment->text()); -// User::insertUser(le_UserCode->text(),user); + if (m_mode == Self) { + if (!this->userNameChanged && !this->commentChanged) return true; + if (!this->userNameChanged) { + if (m_NewUserName.isEmpty()) { + warn(tr("User Name can't be empty!")); + return false; + } + User::Current()->setUserName(m_NewUserName); + } + if (!this->commentChanged) User::Current()->setUserName(le_Comment->text()); + bool ret = User::Current()->submitChange(); + if (ret) { + hideWarn(); + LOG_USER_OPERATION(ChangeUserName); + } + else { + warn(tr("Submit change to database fail!")); + } + return ret; + } + else if (m_mode == Admin) { + if (!this->userNameChanged && !this->roleChanged) return true; + User user; + if (!User::getUser(m_UserID, user)) return true; + if (this->userNameChanged) { + if (m_NewUserName.isEmpty()) { + warn(tr("User Name can't be empty!")); + return false; + } + user.setUserName(m_NewUserName); + } + if (this->roleChanged) user.setRoleID(m_RoleID); + if (!this->commentChanged) user.setComment(le_Comment->text()); + bool ret = user.submitChange(); + if (ret) { + LOG_USER_OPERATION(AdminChangeAcountInformation); + } + return ret; + } + else { + //add new + User user; + if (le_UserCode->text().isEmpty()) { + warn(tr("User ID can't be empty!")); + return false; + } + if (le_UserName->text().isEmpty()) { + warn(tr("User Name can't be empty!")); + return false; + } + if (le_Pwd->text().isEmpty()) { + warn(tr("Password can't be empty!")); + return false; + } + if (!refmodel) { + warn(tr("Inner error ,unset data model!")); + return false; + } + if (User::existsUser(le_UserCode->text())) { + warn(tr("User Id exists!")); + return false; + } + hideWarn(); + user.setUserName(le_UserName->text()); + user.setPassword(User::getEncryptedPassword(le_Pwd->text())); + user.setRoleID(m_RoleID); + user.setComment(le_Comment->text()); + // User::insertUser(le_UserCode->text(),user); - refmodel->insertRow(0); - refmodel->setData(refmodel->index(0, 0), QUuid::createUuid().toString()); - refmodel->setData(refmodel->index(0, 1), le_UserCode->text()); - #define USER_READONLY_PROPERTY(name) name, - #define USER_PROPERTY(name)\ + refmodel->insertRow(0); + refmodel->setData(refmodel->index(0, 0), QUuid::createUuid().toString()); + refmodel->setData(refmodel->index(0, 1), le_UserCode->text()); +#define USER_READONLY_PROPERTY(name) name, +#define USER_PROPERTY(name)\ USER_READONLY_PROPERTY(name) - enum user_index { - USER_PROPERTIES_MACRO() - }; - #undef USER_READONLY_PROPERTY - #undef USER_PROPERTY + enum user_index { + USER_PROPERTIES_MACRO() + }; +#undef USER_READONLY_PROPERTY +#undef USER_PROPERTY - #define USER_READONLY_PROPERTY(name) - #define USER_PROPERTY(name)\ +#define USER_READONLY_PROPERTY(name) +#define USER_PROPERTY(name)\ USER_READONLY_PROPERTY(name)\ refmodel->setData(refmodel->index(0, name),user.get##name()); - USER_PROPERTIES_MACRO() - #undef USER_READONLY_PROPERTY - #undef USER_PROPERTY + USER_PROPERTIES_MACRO() +#undef USER_READONLY_PROPERTY +#undef USER_PROPERTY - if (refmodel->submit()) { - hideWarn(); - return true; - } else { - warn(tr("Submit to data base fail!")); - return false; - } - } - return true; + if (refmodel->submit()) { + hideWarn(); + return true; + } + else { + warn(tr("Submit to data base fail!")); + return false; + } + } + return true; } -void AccountFormDialog::setAccountInformation(const QMap & values) { - le_UserCode->setText(values["UserCode"].toString()); - le_UserName->setText(values["UserName"].toString()); - le_Comment->setText(values["Comment"].toString()); - m_UserID = values["UserID"].toString(); - m_UserPwd = values["Password"].toString(); - if (btn_Role){ - m_RoleID = values["RoleID"].toString(); - btn_Role->setText(User::getRoleName(m_RoleID)); - } +void AccountFormDialog::setAccountInformation(const QMap& values) { + le_UserCode->setText(values["UserCode"].toString()); + le_UserName->setText(values["UserName"].toString()); + le_Comment->setText(values["Comment"].toString()); + m_UserID = values["UserID"].toString(); + m_UserPwd = values["Password"].toString(); + if (btn_Role) { + m_RoleID = values["RoleID"].toString(); + btn_Role->setText(User::getRoleName(m_RoleID)); + } } void AccountFormDialog::warn(QString msg) { - lbl_error->setText(msg); - lbl_error->setVisible(true); + lbl_error->setText(msg); + lbl_error->setVisible(true); } void AccountFormDialog::hideWarn() { - this->lbl_error->setVisible(false); + this->lbl_error->setVisible(false); } diff --git a/src/AccountTableForm.cpp b/src/AccountTableForm.cpp index d927854..ac9fb6d 100644 --- a/src/AccountTableForm.cpp +++ b/src/AccountTableForm.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include "components/AccountRoleComboDelegate.h" #include "guimacros.h" #include "AlertDialog.h" #include "db/SQLHelper.h" diff --git a/src/ChangePasswordFormDialog.cpp b/src/ChangePasswordFormDialog.cpp index 3c3d137..b6f0b14 100644 --- a/src/ChangePasswordFormDialog.cpp +++ b/src/ChangePasswordFormDialog.cpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include "models/User.h" +#include "log/UserOperationLog.h" #include "ChangePasswordFormDialog.h" ChangePasswordFormDialog::ChangePasswordFormDialog(QWidget* parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) { diff --git a/src/GUIFormBaseDialog.cpp b/src/GUIFormBaseDialog.cpp index ab4175f..f2b5e01 100644 --- a/src/GUIFormBaseDialog.cpp +++ b/src/GUIFormBaseDialog.cpp @@ -6,35 +6,35 @@ #include #include #include -GUIFormBaseDialog::GUIFormBaseDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { - this->setObjectName("formDialog"); - this->setWindowFlags (Qt :: FramelessWindowHint | Qt :: Dialog); -// this->setFixedSize(500,600); - this->setFixedWidth(500); - this->formWidget = new QWidget(this); - this->formWidget->setObjectName("formWidget"); +GUIFormBaseDialog::GUIFormBaseDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f) { + this->setObjectName("formDialog"); + this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); + // this->setFixedSize(500,600); + this->setFixedWidth(500); + this->formWidget = new QWidget(this); + this->formWidget->setObjectName("formWidget"); - QVBoxLayout* vLayout = new QVBoxLayout(this); -// vLayout->setContentsMargins(680,100,680,100); - vLayout->addWidget(formWidget); + QVBoxLayout* vLayout = new QVBoxLayout(this); + // vLayout->setContentsMargins(680,100,680,100); + vLayout->addWidget(formWidget); - QWidget* btnWidget= new QWidget(this); - vLayout->addWidget(btnWidget); - QHBoxLayout* hLayout = new QHBoxLayout(btnWidget); - btnOk= new QPushButton(btnWidget); - btnOk->setText("OK"); - btnCancel = new QPushButton(btnWidget); - btnCancel->setText("Cancel"); - hLayout->addWidget(btnOk); - hLayout->addWidget(btnCancel); - btnOk->setObjectName("btnOK"); - connect(btnOk, &QPushButton::clicked, [t=this](){ - if(t->updateReferenceData()) - t->accept(); - }); - connect(btnCancel, &QPushButton::clicked, [t=this](){ - t->reject(); - }); + QWidget* btnWidget = new QWidget(this); + vLayout->addWidget(btnWidget); + QHBoxLayout* hLayout = new QHBoxLayout(btnWidget); + btnOk = new QPushButton(btnWidget); + btnOk->setText(tr("OK")); + btnCancel = new QPushButton(btnWidget); + btnCancel->setText(tr("Cancel")); + hLayout->addWidget(btnOk); + hLayout->addWidget(btnCancel); + btnOk->setObjectName(tr("btnOK")); + connect(btnOk, &QPushButton::clicked, [t = this]() { + if (t->updateReferenceData()) + t->accept(); + }); + connect(btnCancel, &QPushButton::clicked, [t = this]() { + t->reject(); + }); } GUIFormBaseDialog::~GUIFormBaseDialog() { @@ -42,24 +42,24 @@ GUIFormBaseDialog::~GUIFormBaseDialog() { } void GUIFormBaseDialog::setButtonMode(DialogButtonMode mode) { - switch (mode) { - case OkOnly: - { - btnOk->setVisible(true); - btnCancel->setVisible(false); - return; - } - case OkAndCancel: - { - btnOk->setVisible(true); - btnCancel->setVisible(true); - return; - } - case None: - default: - { - btnOk->setVisible(false); - btnCancel->setVisible(false); - } - } + switch (mode) { + case OkOnly: + { + btnOk->setVisible(true); + btnCancel->setVisible(false); + return; + } + case OkAndCancel: + { + btnOk->setVisible(true); + btnCancel->setVisible(true); + return; + } + case None: + default: + { + btnOk->setVisible(false); + btnCancel->setVisible(false); + } + } } diff --git a/src/ScanFormWidget.cpp b/src/ScanFormWidget.cpp index 38e6934..fad62c3 100644 --- a/src/ScanFormWidget.cpp +++ b/src/ScanFormWidget.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include "log/UserOperationLog.h" #include #ifdef WIN32 diff --git a/src/SelectFormWidget.cpp b/src/SelectFormWidget.cpp index c191c45..20c3d0f 100644 --- a/src/SelectFormWidget.cpp +++ b/src/SelectFormWidget.cpp @@ -248,6 +248,8 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) : btnAdd->setEnabled(true); }); + + } diff --git a/src/TopBarWidget.cpp b/src/TopBarWidget.cpp index f39f5bf..e49c42d 100644 --- a/src/TopBarWidget.cpp +++ b/src/TopBarWidget.cpp @@ -5,7 +5,7 @@ #include "TopBarWidget.h" #include #include -#include +#include "components/RollingMessageWidget.h" #include #include "event/EventCenter.h" #include "errorhandle/GUIErrorLW.h" diff --git a/src/device/DeviceManager.cpp b/src/device/DeviceManager.cpp index 43fb04e..e11dead 100644 --- a/src/device/DeviceManager.cpp +++ b/src/device/DeviceManager.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include "appvals/AppGlobalValues.h" #define TRIGGER_EVENT EventCenter::Default()->triggerEvent diff --git a/src/errorhandle/GUIErrorLW.cpp b/src/errorhandle/GUIErrorLW.cpp index f5bf849..c1d8f55 100644 --- a/src/errorhandle/GUIErrorLW.cpp +++ b/src/errorhandle/GUIErrorLW.cpp @@ -2,7 +2,7 @@ // Created by Krad on 2021/12/17. // -#include +#include "event/EventCenter.h" #include "GUIErrorLW.h" #include diff --git a/src/generalform.cpp b/src/generalform.cpp index 954bd6a..bdb154c 100644 --- a/src/generalform.cpp +++ b/src/generalform.cpp @@ -1,5 +1,6 @@ #include "generalform.h" +#include #include #include #include @@ -7,7 +8,7 @@ #include #include #include -#include +#include "event/EventCenter.h" #include "json/jsonobject.h" #include "SelectDialog.h" @@ -21,7 +22,9 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) layout->addWidget(lanHeader); QHBoxLayout* lanHeaderLayout = new QHBoxLayout(lanHeader); - lanHeaderLayout->addWidget(new QLabel(tr("Language"))); + QLabel* lbl_lan = new QLabel(tr("Language")); + lanHeaderLayout->addWidget(lbl_lan); + QPushButton* btnLan = new QPushButton(lanHeader); lanHeaderLayout->addWidget(btnLan); lanHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding)); @@ -29,12 +32,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)); @@ -43,7 +49,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); @@ -90,19 +99,15 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent) //take effect JsonObject::Instance()->setDefaultLanguage(lan); LanguageSwitcher::Instance()->setDefaultLanguage(lan); - btnLan->setText(JsonObject::Instance()->defaultLanguage()); - EventCenter::Default()->triggerEvent(ReloadLanguage, nullptr,nullptr); + } }); + + connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { + lbl_lan->setText(tr("Language")); + lbl_ins->setText(tr("Institution Addr")); + lbl_insaddr->setText(tr("Institution Addr")); + lbl_lock->setText(tr("Lock Screen Timeout")); + }); } - -void GeneralForm::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - qDebug() << "change language"; - - } - QWidget::changeEvent(event); -} \ No newline at end of file diff --git a/src/generalform.h b/src/generalform.h index cd62d82..290c60f 100644 --- a/src/generalform.h +++ b/src/generalform.h @@ -6,18 +6,13 @@ class QPushButton; class QVBoxLayout; class SelectDialog; + class GeneralForm : public QWidget { Q_OBJECT public: explicit GeneralForm(QWidget* parent = nullptr); -signals: - -public slots: -protected: - void changeEvent(QEvent* event); - private: QVBoxLayout* layout = nullptr; SelectDialog* dialog = nullptr; diff --git a/src/guimacros.h b/src/guimacros.h index 2b6e0a2..47d78c7 100644 --- a/src/guimacros.h +++ b/src/guimacros.h @@ -10,7 +10,7 @@ btn##name->setIcon(QIcon(img));\ btn##name->setIconSize(QSize(size,size));\ btn##name->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);\ - btn##name->setText(tr(#name));\ + btn##name->setText(QObject::tr(#name));\ layout->addWidget(btn##name); #define ADD_TOOL_BTN_TO_LAYOUT(name,img,layout)\ diff --git a/src/json/jsonobject.cpp b/src/json/jsonobject.cpp index a1cd44b..627642e 100644 --- a/src/json/jsonobject.cpp +++ b/src/json/jsonobject.cpp @@ -40,10 +40,10 @@ void JsonObject::setJsonString(const char* catergory, const char* stringName, co char* JsonObject::getJsonString(const char* catergory, const char* stringName) { if (!loadcfg()) - return ""; + return nullptr; cJSON* first = cJSON_GetObjectItem((cJSON*)json_root, catergory); - if (!first) return ""; + if (!first) return nullptr; cJSON* second = cJSON_GetObjectItem(first, stringName); return second->valuestring; @@ -52,13 +52,13 @@ char* JsonObject::getJsonString(const char* catergory, const char* stringName) char* JsonObject::getArrayNode(const char* catergory, const char* stringName, int index, const char* id) { if (!loadcfg()) - return ""; + return nullptr; cJSON* first = cJSON_GetObjectItem((cJSON*)json_root, catergory); - if (!first) return ""; + if (!first) return nullptr; cJSON* second = cJSON_GetObjectItem(first, stringName); - if (!second) return ""; + if (!second) return nullptr; cJSON* third = cJSON_GetArrayItem(second, index); diff --git a/src/languageswitcher.cpp b/src/languageswitcher.cpp index 505fe45..f2fc8ee 100644 --- a/src/languageswitcher.cpp +++ b/src/languageswitcher.cpp @@ -1,5 +1,6 @@ #include "languageswitcher.h" #include +#include "event/EventCenter.h" LanguageSwitcher* LanguageSwitcher::lsw = Q_NULLPTR; @@ -31,5 +32,6 @@ void LanguageSwitcher::setDefaultLanguage(QString str) //qDebug() << "installTranslator"; //QApplication::installTranslator(translator); } + EventCenter::Default()->triggerEvent(ReloadLanguage, nullptr, nullptr); } diff --git a/src/locker.cpp b/src/locker.cpp index 2abb693..cddb6fa 100644 --- a/src/locker.cpp +++ b/src/locker.cpp @@ -2,7 +2,7 @@ #include #include "appvals/AppGlobalValues.h" -#include +#include "event/EventCenter.h" #include "json/jsonobject.h" Locker* Locker::locker = Q_NULLPTR; diff --git a/src/loginwindow.cpp b/src/loginwindow.cpp index e117b07..e722fed 100644 --- a/src/loginwindow.cpp +++ b/src/loginwindow.cpp @@ -14,19 +14,19 @@ #include "log/UserOperationLog.h" LoginWindow::LoginWindow(QWidget* parent) - : QDialog(parent) - , m_pLoginButton(nullptr) - , m_pVMainLayout(nullptr) - , m_pUserCodeFrame(nullptr) - , m_pUserCodeLayout(nullptr) - , m_pUserCodeEdit(nullptr) - , m_pPassWordEdit(nullptr) + : QDialog(parent) + , m_pLoginButton(nullptr) + , m_pVMainLayout(nullptr) + , m_pUserCodeFrame(nullptr) + , m_pUserCodeLayout(nullptr) + , m_pUserCodeEdit(nullptr) + , m_pPassWordEdit(nullptr) { - initUi(); - init(); - setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); - //Dialog::Instance()->InitForm(); - m_pUserCodeEdit->setText("usct"); + initUi(); + init(); + setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); + //Dialog::Instance()->InitForm(); + m_pUserCodeEdit->setText(tr("usct")); } LoginWindow::~LoginWindow() @@ -37,75 +37,76 @@ LoginWindow::~LoginWindow() void LoginWindow::initUi() { - QString style = "*{background-color:#3c3c3c; color:white;margin:0;font-size:16px;}" - "QLabel#title{font-Size:98px;color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," - "stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);}" - "QLabel#warn{color:#930000;background:transparent;font-size:20px;}" - "QFrame#login_frame_username{min-width:700px;max-width:700px;max-height:500px;min-height:500px;" - "border:1px solid #0078d8;border-radius:20px;" - "background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n" - " stop: 0.0 darkgray, stop: 0.5 gray, stop: 1.0 darkgray);" - "}" - "QLineEdit{min-height:100px;max-height:100px; border:1px solid silver;border-radius:10px;font-size:26px;}" - "QLineEdit:enabled{background-color: #515151}" - "QComboBox{text-align:center;min-height:100px;max-height:100px; " - "border:1px solid silver;border-radius:10px;padding:3px}" - "QComboBox:enabled{background-color: #515151}" - "QComboBox::drop-down{width:80px;border-radius:10px}" - "QComboBox QAbstractItemView{min-width:120px;}" - "QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;}" - "QToolButton{min-height:100px;max-height:100px;border:1px solid #505050;" - "border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}" - "QToolButton:hover{background:#505050;}"; - setStyleSheet(style); + QString style = "*{background-color:#3c3c3c; color:white;margin:0;font-size:16px;}" + "QLabel#title{font-Size:98px;color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," + "stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);}" + "QLabel#warn{color:#930000;background:transparent;font-size:20px;}" + "QFrame#login_frame_username{min-width:700px;max-width:700px;max-height:500px;min-height:500px;" + "border:1px solid #0078d8;border-radius:20px;" + "background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n" + " stop: 0.0 darkgray, stop: 0.5 gray, stop: 1.0 darkgray);" + "}" + "QLineEdit{min-height:100px;max-height:100px; border:1px solid silver;border-radius:10px;font-size:26px;}" + "QLineEdit:enabled{background-color: #515151}" + "QComboBox{text-align:center;min-height:100px;max-height:100px; " + "border:1px solid silver;border-radius:10px;padding:3px}" + "QComboBox:enabled{background-color: #515151}" + "QComboBox::drop-down{width:80px;border-radius:10px}" + "QComboBox QAbstractItemView{min-width:120px;}" + "QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;}" + "QToolButton{min-height:100px;max-height:100px;border:1px solid #505050;" + "border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}" + "QToolButton:hover{background:#505050;}"; + setStyleSheet(style); - m_pVMainLayout = new QVBoxLayout(this); - m_pVMainLayout->setContentsMargins(0, 0, 0, 0); - m_pVMainLayout->setSpacing(0); - m_pVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); + m_pVMainLayout = new QVBoxLayout(this); + m_pVMainLayout->setContentsMargins(0, 0, 0, 0); + m_pVMainLayout->setSpacing(0); + m_pVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); - QLabel* title = new QLabel(this); - title->setObjectName("title"); - title->setText("U S C T"); - m_pVMainLayout->addWidget(title, 0, Qt::AlignCenter); - m_pUserCodeFrame = new QFrame(this); - m_pUserCodeFrame->setObjectName("login_frame_username"); - m_pUserCodeLayout = new QVBoxLayout(m_pUserCodeFrame); - m_pUserCodeLayout->setSpacing(30); - m_pUserCodeLayout->setContentsMargins(20, 60, 20, 20); - warn = new QLabel(this); - warn->setObjectName("warn"); - warn->setText("Login failed, username or password error!"); - warn->setVisible(false); - m_pUserCodeLayout->addWidget(warn, 0, Qt::AlignCenter); - m_pUserCodeEdit = new QLineEdit(m_pUserCodeFrame); - m_pUserCodeEdit->setObjectName("combobox_UserName"); + QLabel* title = new QLabel(this); + title->setObjectName("title"); + title->setText(tr("U S C T")); + m_pVMainLayout->addWidget(title, 0, Qt::AlignCenter); + m_pUserCodeFrame = new QFrame(this); + m_pUserCodeFrame->setObjectName("login_frame_username"); + m_pUserCodeLayout = new QVBoxLayout(m_pUserCodeFrame); + m_pUserCodeLayout->setSpacing(30); + m_pUserCodeLayout->setContentsMargins(20, 60, 20, 20); + warn = new QLabel(this); + warn->setObjectName("warn"); + warn->setText("Login failed, username or password error!"); + warn->setVisible(false); + m_pUserCodeLayout->addWidget(warn, 0, Qt::AlignCenter); + m_pUserCodeEdit = new QLineEdit(m_pUserCodeFrame); + m_pUserCodeEdit->setObjectName("combobox_UserName"); - //m_pUserCodeEdit->setLineEdit(new QLineEdit(m_pUserCodeFrame)); + //m_pUserCodeEdit->setLineEdit(new QLineEdit(m_pUserCodeFrame)); - m_pUserCodeEdit->setPlaceholderText(tr("Username")); - m_pUserCodeLayout->addWidget(m_pUserCodeEdit); - m_pVMainLayout->addWidget(m_pUserCodeFrame, 0, Qt::AlignCenter); + m_pUserCodeEdit->setPlaceholderText(tr("Username")); + m_pUserCodeLayout->addWidget(m_pUserCodeEdit); + m_pVMainLayout->addWidget(m_pUserCodeFrame, 0, Qt::AlignCenter); - m_pPassWordEdit = new QLineEdit(this); - m_pPassWordEdit->setObjectName("edt_Password"); - m_pPassWordEdit->setEchoMode(QLineEdit::Password); - m_pPassWordEdit->setPlaceholderText(tr("Password")); - m_pUserCodeLayout->addWidget(m_pPassWordEdit); + m_pPassWordEdit = new QLineEdit(this); + m_pPassWordEdit->setObjectName("edt_Password"); + m_pPassWordEdit->setEchoMode(QLineEdit::Password); + m_pPassWordEdit->setPlaceholderText(tr("Password")); + m_pUserCodeLayout->addWidget(m_pPassWordEdit); - ADD_TOOL_BTN_TO_LAYOUT(login, ":/icons/login.png", m_pUserCodeLayout); - m_pUserCodeLayout->removeWidget(btnlogin); - m_pUserCodeLayout->addWidget(btnlogin, 0, Qt::AlignCenter); - m_pLoginButton = btnlogin; - // m_pUserCodeLayout->addWidget(m_pLoginButton, 0, Qt::AlignCenter); - m_pVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); + ADD_TOOL_BTN_TO_LAYOUT(login, ":/icons/login.png", m_pUserCodeLayout); - initUserList(); + m_pUserCodeLayout->removeWidget(btnlogin); + m_pUserCodeLayout->addWidget(btnlogin, 0, Qt::AlignCenter); + m_pLoginButton = btnlogin; + // m_pUserCodeLayout->addWidget(m_pLoginButton, 0, Qt::AlignCenter); + m_pVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); + + initUserList(); } void LoginWindow::init() { - connect(m_pLoginButton, SIGNAL(clicked()), this, SLOT(doLogin())); + connect(m_pLoginButton, SIGNAL(clicked()), this, SLOT(doLogin())); } void LoginWindow::initUserList() @@ -114,31 +115,31 @@ void LoginWindow::initUserList() void LoginWindow::clearInputData() { - m_pUserCodeEdit->clear(); - m_pPassWordEdit->clear(); - //m_pUserCodeEdit->setFocus(); + m_pUserCodeEdit->clear(); + m_pPassWordEdit->clear(); + //m_pUserCodeEdit->setFocus(); } void LoginWindow::doLogin() { - QString strUserCode = m_pUserCodeEdit->text(); - QString strPassWord = m_pPassWordEdit->text(); + QString strUserCode = m_pUserCodeEdit->text(); + QString strPassWord = m_pPassWordEdit->text(); - QString encryptedPassword = strPassWord; - strPassWord = "123456"; + QString encryptedPassword = strPassWord; + strPassWord = "123456"; - QString encryptPwd = User::getEncryptedPassword(strPassWord); + QString encryptPwd = User::getEncryptedPassword(strPassWord); QString sql = QString("select UserCode from Account where UserCode='%1' and Password='%2'") - .arg(strUserCode).arg(encryptPwd); - if(User::QueryUser(strUserCode,encryptPwd)) - { - accept(); + .arg(strUserCode).arg(encryptPwd); + if (User::QueryUser(strUserCode, encryptPwd)) + { + accept(); LOG_USER_OPERATION(Login); - } - else { - warn->setVisible(true); - } + } + else { + warn->setVisible(true); + } } diff --git a/src/main.cpp b/src/main.cpp index 6238280..8235e72 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,7 @@ #include "loginwindow.h" #include "InputObject.h" #include -#include +#include "db/SQLHelper.h" #include #include #include @@ -47,10 +47,16 @@ int main(int argc, char* argv[]) QTextCodec* codec = QTextCodec::codecForName("utf8"); QTextCodec::setCodecForLocale(codec); + + //multi-language suppport + QTranslator translator; + LanguageSwitcher::Instance()->setTranslator(&translator); + LanguageSwitcher::Instance()->setDefaultLanguage(JsonObject::Instance()->defaultLanguage()); + a.installTranslator(&translator); + + //QString fontName = loadFontFromFile(":/fonts/MicrosoftYahei.ttf"); QString fontName = loadFontFromFile(":/fonts/DroidSansFallback.ttf"); - - QFont font(fontName); QApplication::setFont(font); @@ -65,11 +71,7 @@ int main(int argc, char* argv[]) //QObject::connect(obj, SIGNAL(touchScreen()), Locker::Instance(), SLOT(refreshTimer())); - //multi-language suppport - QTranslator translator; - LanguageSwitcher::Instance()->setTranslator(&translator); - LanguageSwitcher::Instance()->setDefaultLanguage(JsonObject::Instance()->defaultLanguage()); - a.installTranslator(&translator); + QStringList app_args = a.arguments(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8e0461a..2b47eb7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "event/EventCenter.h" #include "tabformwidget.h" #include "SelectFormWidget.h" #include "ScanFormWidget.h" @@ -82,14 +82,14 @@ MainWindow::MainWindow(QWidget* parent) : "QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;}" //"QScrollBar:vertical {min-width: 50px;}" "QLabel{color:white; font-weight:bold; font-size:16px;}\n" - "QLabel#sliderPickerLabel{color:silver;padding:0;background:#505050;font-weight:normal;font-size:50px;}\n" + "QLabel#sliderPickerLabel{color:silver;padding:0;background:#505050;font-weight:normal;font-size:50px;}\n" "QWidget#topbarWidget{min-height:36px;max-height:36px;}\n" "QWidget#contentWidget{border-top:1px solid #515151;}\n" "QWidget#commandWidget{min-height:123px;max-height:123px;border-top:1px solid #515151; border-bottom:1px solid #323232;}\n" "QLabel#logo{min-width:30px;max-width:30px}\n" "QLabel#company{min-width:150px;max-width:150px; }\n" "QLabel#systemMsgBar{min-width:500px;}" - "QLabel#warn{color:#CCCC00;background:transparent;font-size:20px;}" + "QLabel#warn{color:#CCCC00;background:transparent;font-size:20px;}" "QWidget QWidget#statusBarWidget{min-width:300px;}\n" "QWidget QToolButton{border:none;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}\n" "QToolButton#btn_main{border:2px solid #0078d8;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}\n" @@ -103,32 +103,32 @@ MainWindow::MainWindow(QWidget* parent) : "QDialog QWidget#innerWidget{ 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; }" - "QDialog#MessageDialog QWidget QWidget{ background:transparent;color:#3078d8}" - "QDialog#MessageDialog QWidget QWidget QLabel{ font-size:30px}" + "QDialog#MessageDialog QWidget QWidget{ background:transparent;color:#3078d8}" + "QDialog#MessageDialog QWidget QWidget QLabel{ font-size:30px}" "#spacer_1, #spacer_2{min-width:2px;max-width:2px;margin-top:6px;margin-bottom:6px;border-right:1px solid #0078d8;}" //FormDialog - "QPushButton{border:1px solid silver ;padding-left:50px;padding-right:50px; border-radius:5px; min-height:28px; max-height:28px; background:#4c5052}" - "QPushButton#btnOK{background:#365880; font-weight:bold}" - "QDialog#formDialog{border:3px solid silver; border-radius:8px}" - "QWidget#slider_one{border:1px solid silver; border-radius:8px}" - "QWidget#formWidget QLabel#endline{border-bottom:1px solid silver}" - "QWidget#formWidget QLabel#title{font-size:30px; border-bottom:1px solid #3078d8 }" - "QListView{border:none;margin:5px; font-weight:bold}" - "QListView::item{background:#4c5052;min-height:30px; border:1px solid silver; border-radius:5px}" - "QListView::item:selected{background:#365880; font-weight:bold;color:white}" - "QHeaderView::section{background-color:#595959;" - "min-height:50px;max-height:50px;" - "font-weight:Bold; font-size:16px; border:1px solid #323232;}" - "QHeaderView::section:horizontal{border-bottom: 1px solid rgb(0,170,255);}" - "QHeaderView::section:vertical{min-height:36px;max-height:36px;}" - "QWidget#edit_patient{min-width:300px;max-width:300px;}" - "QTableView{border:none}" - "QTableView{alternate-background-color: #595959;selection-color:white;selection-background-color:#0078d8}" - "QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;}" - "QToolButton#sexBtn:disabled{color:silver}" - "QWidget#sexpanelwidget{border:1px solid silver;}" - "QWidget#sexpanelwidget:enabled{background-color: #515151;}" - "QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;}" + "QPushButton{border:1px solid silver ;padding-left:50px;padding-right:50px; border-radius:5px; min-height:28px; max-height:28px; background:#4c5052}" + "QPushButton#btnOK{background:#365880; font-weight:bold}" + "QDialog#formDialog{border:3px solid silver; border-radius:8px}" + "QWidget#slider_one{border:1px solid silver; border-radius:8px}" + "QWidget#formWidget QLabel#endline{border-bottom:1px solid silver}" + "QWidget#formWidget QLabel#title{font-size:30px; border-bottom:1px solid #3078d8 }" + "QListView{border:none;margin:5px; font-weight:bold}" + "QListView::item{background:#4c5052;min-height:30px; border:1px solid silver; border-radius:5px}" + "QListView::item:selected{background:#365880; font-weight:bold;color:white}" + "QHeaderView::section{background-color:#595959;" + "min-height:50px;max-height:50px;" + "font-weight:Bold; font-size:16px; border:1px solid #323232;}" + "QHeaderView::section:horizontal{border-bottom: 1px solid rgb(0,170,255);}" + "QHeaderView::section:vertical{min-height:36px;max-height:36px;}" + "QWidget#edit_patient{min-width:300px;max-width:300px;}" + "QTableView{border:none}" + "QTableView{alternate-background-color: #595959;selection-color:white;selection-background-color:#0078d8}" + "QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;}" + "QToolButton#sexBtn:disabled{color:silver}" + "QWidget#sexpanelwidget{border:1px solid silver;}" + "QWidget#sexpanelwidget:enabled{background-color: #515151;}" + "QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;}" ; this->setStyleSheet(style); ui->setupUi(this); @@ -139,47 +139,48 @@ MainWindow::MainWindow(QWidget* parent) : tab->setCurrentIndex(1); }); SelectFormWidget* select_form = new SelectFormWidget(this); - tab->addTab(select_form, "Select"); + tab->addTab(select_form, tr("Select")); ScanFormWidget* scan_form = new ScanFormWidget(this); - tab->addTab(scan_form, "Scan"); + tab->addTab(scan_form, tr("Scan")); TabFormWidget* verify_form = new TabFormWidget(this); - tab->addTab(verify_form, "Verify"); + tab->addTab(verify_form, tr("Verify")); tab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); - layout->setSpacing(0); - QWidget * top = new TopBarWidget(this); - top->setObjectName("topbarWidget"); + layout->setSpacing(0); + QWidget* top = new TopBarWidget(this); + top->setObjectName("topbarWidget"); layout->addWidget(top); layout->addWidget(tab); ui->centralWidget->setLayout(layout); this->setWindowFlags(Qt::Window); connect(EventCenter::Default(), &EventCenter::DeviceErrorRaise, [=](QObject* parent, QObject* msg) { - //默认旧模式 - if (!msgDialog) { - msgDialog = new GUIMessageDialog(this); - msgDialog->setStyleSheet(style); - } - if (msg) { - QString *str = (QString *) msg; - msgDialog->showMessage(*str); - } else { - msgDialog->showMessage("Something went error!"); - } - msgDialog->stopLoading(); - msgDialog->showExitButton(); - if (msgDialog->isHidden()){ - msgDialog->setWindowModality(Qt::NonModal); - msgDialog->exec(); - } - }); + //默认旧模式 + if (!msgDialog) { + msgDialog = new GUIMessageDialog(this); + msgDialog->setStyleSheet(style); + } + if (msg) { + QString* str = (QString*)msg; + msgDialog->showMessage(*str); + } + else { + msgDialog->showMessage("Something went error!"); + } + msgDialog->stopLoading(); + msgDialog->showExitButton(); + if (msgDialog->isHidden()) { + msgDialog->setWindowModality(Qt::NonModal); + msgDialog->exec(); + } + }); connect(EventCenter::Default(), &EventCenter::InvokeOperationStart, [=](QObject*, QObject* msg) { - if (msgDialog){ - msgDialog->hide(); - delete msgDialog; - } - msgDialog = new GUIMessageDialog(this); + if (msgDialog) { + msgDialog->hide(); + delete msgDialog; + } + msgDialog = new GUIMessageDialog(this); if (msg) { QString* str = (QString*)msg; @@ -191,11 +192,11 @@ MainWindow::MainWindow(QWidget* parent) : msgDialog->hideExitButton(); msgDialog->startLoading(); AppGlobalValues::setInProcessing(true); - // msgDialog->showFullScreen(); - if (msgDialog->isHidden()){ - msgDialog->show(); - } - }); + // msgDialog->showFullScreen(); + if (msgDialog->isHidden()) { + msgDialog->show(); + } + }); connect(EventCenter::Default(), &EventCenter::InvokeOperationProgress, [=](QObject*, QObject* msg) { if (!msgDialog) msgDialog = new GUIMessageDialog(this); if (msg) @@ -206,58 +207,70 @@ MainWindow::MainWindow(QWidget* parent) : else { msgDialog->hideMessage(); } - // msgDialog->showFullScreen(); - if (msgDialog->isHidden())msgDialog->show(); + // msgDialog->showFullScreen(); + if (msgDialog->isHidden())msgDialog->show(); }); connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd, [=]() { if (!msgDialog) return; - if (!msgDialog->isHidden())msgDialog->accept(); - delete msgDialog; - msgDialog = nullptr; - AppGlobalValues::setInProcessing(false); - }); - connect(EventCenter::Default(), &EventCenter::RequestLogin, [=](QObject*, QObject* msg) { - this->requestLogin(); - }); - connect(EventCenter::Default(), &EventCenter::LoginRoleChanged, [=](QObject*, QObject*) { - if (User::Current()->isAdmin() ) - { - if (admin_tab_index == -1) - { - AdminSettingForm * form = new AdminSettingForm(this); - admin_tab_index = tab->addTab(form,"Admin"); - } - } else{ - if (admin_tab_index != -1){ - tab->removeTab(admin_tab_index); - admin_tab_index = -1; - } - } - qApp->processEvents(); - }); + if (!msgDialog->isHidden())msgDialog->accept(); + delete msgDialog; + msgDialog = nullptr; + AppGlobalValues::setInProcessing(false); + }); + connect(EventCenter::Default(), &EventCenter::RequestLogin, [=](QObject*, QObject* msg) { + this->requestLogin(); + }); + connect(EventCenter::Default(), &EventCenter::LoginRoleChanged, [=](QObject*, QObject*) { + if (User::Current()->isAdmin()) + { + if (admin_tab_index == -1) + { + AdminSettingForm* form = new AdminSettingForm(this); + admin_tab_index = tab->addTab(form, tr("Admin")); + } + } + else { + if (admin_tab_index != -1) { + tab->removeTab(admin_tab_index); + admin_tab_index = -1; + } + } + qApp->processEvents(); + }); - GUIErrorHandle::Default()->init(); - DeviceManager::Default()->initDevice(); + GUIErrorHandle::Default()->init(); + DeviceManager::Default()->initDevice(); - QThread* t = QThread::create([](){ - QThread::sleep(10); - int f = 0x00100001; - for (int i = 0; i < 8; ++i) { - QThread::sleep(10); - f= f << (i*4); - printf("invoke %d\r\n", f); - char* v = (char*)&f; - QString msg; - msg.append("w "); - msg.append(v[0]); - msg.append(v[1]); - msg.append(v[2]); - msg.append(v[3]); - EventCenter::Default()->triggerEvent(GUIErrorRaise,nullptr,(QObject*)&msg); - } - }); - t->start(); + QThread* t = QThread::create([]() { + QThread::sleep(10); + int f = 0x00100001; + for (int i = 0; i < 8; ++i) { + QThread::sleep(10); + f = f << (i * 4); + printf("invoke %d\r\n", f); + char* v = (char*)&f; + QString msg; + msg.append("w "); + msg.append(v[0]); + msg.append(v[1]); + msg.append(v[2]); + msg.append(v[3]); + EventCenter::Default()->triggerEvent(GUIErrorRaise, nullptr, (QObject*)&msg); + } + }); + t->start(); centerWidgetHide(); + + connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { + + tab->setTabText(0, tr("Select")); + tab->setTabText(1, tr("Scan")); + tab->setTabText(2, tr("Verify")); + tab->setTabText(3, tr("Admin")); + + }); + + } MainWindow::~MainWindow() @@ -276,7 +289,7 @@ void MainWindow::changeEvent(QEvent* event) } void MainWindow::centerWidgetHide() { - ui->centralWidget->setVisible(false); + ui->centralWidget->setVisible(false); } void MainWindow::centerWidgetShow() { @@ -291,19 +304,19 @@ QTextEdit* MainWindow::getEdit() } void MainWindow::requestLogin() { - LoginWindow l(this); - l.setWindowModality(Qt::WindowModal); - l.showFullScreen(); - this->centerWidgetHide(); - while(l.result() != QDialog::Accepted) - { - l.exec(); - } - this->centerWidgetShow(); + LoginWindow l(this); + l.setWindowModality(Qt::WindowModal); + l.showFullScreen(); + this->centerWidgetHide(); + while (l.result() != QDialog::Accepted) + { + l.exec(); + } + this->centerWidgetShow(); } void MainWindow::debugConsoleOn() { - QTextEdit* text_edit = new QTextEdit(this); + QTextEdit* text_edit = new QTextEdit(this); ui->centralWidget->layout()->addWidget(text_edit); const QString edit_style = "QScrollBar:vertical{border: 0px solid grey; background:#2d2d2d; width: 15px; margin: 0px 0 0px 0; }" diff --git a/src/network/getadminpsw.cpp b/src/network/getadminpsw.cpp index f9f814b..27da659 100644 --- a/src/network/getadminpsw.cpp +++ b/src/network/getadminpsw.cpp @@ -18,7 +18,7 @@ GetAdminPsw::GetAdminPsw(QWidget* parent, Qt::WindowFlags f) : GUIFormBaseDialog form->addRow(value1, _psw); lbl_error = new QLabel(this); - lbl_error->setObjectName("warn"); + lbl_error->setObjectName(QString::fromUtf8("warn")); form->addRow("", lbl_error); } diff --git a/src/network/getipdialog.cpp b/src/network/getipdialog.cpp index c440de5..0b97bed 100644 --- a/src/network/getipdialog.cpp +++ b/src/network/getipdialog.cpp @@ -12,15 +12,16 @@ GetIPDialog::GetIPDialog(QWidget* parent, Qt::WindowFlags f) : GUIFormBaseDialog setWindowModality(Qt::WindowModal); QFormLayout* form = new QFormLayout(formWidget); - QString value1 = QString("IP Address"); + QLabel* value1 = new QLabel(tr("IP Address")); _ip = new QLineEdit(this); form->addRow(value1, _ip); - QString value2 = QString("Netmask"); + + QLabel* value2 = new QLabel(tr("Netmask")); _mask = new QLineEdit(this); form->addRow(value2, _mask); lbl_error = new QLabel(this); - lbl_error->setObjectName("warn"); + lbl_error->setObjectName(QString::fromUtf8("warn")); form->addRow("", lbl_error); } diff --git a/src/network/getroutedialog.cpp b/src/network/getroutedialog.cpp index 762801c..378482d 100644 --- a/src/network/getroutedialog.cpp +++ b/src/network/getroutedialog.cpp @@ -12,13 +12,13 @@ GetRouteDialog::GetRouteDialog(QWidget* parent, Qt::WindowFlags f) : GUIFormBase setWindowModality(Qt::WindowModal); QFormLayout* form = new QFormLayout(formWidget); - QString value1 = QString("Destination"); + QString value1 = QString(tr("Destination")); _des = new QLineEdit(this); form->addRow(value1, _des); - QString value2 = QString("Netmask"); + QString value2 = QString(tr("Netmask")); _mask = new QLineEdit(this); form->addRow(value2, _mask); - QString value3 = QString("Gateway"); + QString value3 = QString(tr("Gateway")); _gw = new QLineEdit(this); form->addRow(value3, _gw); diff --git a/src/network/networkcfgdialog.cpp b/src/network/networkcfgdialog.cpp index 1402edc..b781379 100644 --- a/src/network/networkcfgdialog.cpp +++ b/src/network/networkcfgdialog.cpp @@ -30,12 +30,15 @@ networkCfgDialog::networkCfgDialog(QWidget* parent) : model_route = new NetCfgTableModel(this); QStringList header_addr; - header_addr << "IP Address" << "Netmask"; + header_addr << tr("IP Address") << tr("Netmask"); model_addr->setHeader(header_addr); QStringList route_addr; - route_addr << "Destination" << "Gateway" << "Netmask"; + route_addr << tr("Destination") << tr("Gateway") << tr("Netmask"); model_route->setHeader(route_addr); + ui->btn_group->button(QDialogButtonBox::Apply)->setText(tr("Apply")); + ui->btn_group->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); + loadData(); ui->tbl_addr->setModel(model_addr); @@ -62,6 +65,7 @@ networkCfgDialog::networkCfgDialog(QWidget* parent) : ui->tbl_route->setColumnWidth(2, 230); ui->tbl_route->horizontalHeader()->setFixedHeight(38); + connect(ui->btn_addr_add, &QPushButton::clicked, [=]() { //GetIPDialog* dialog = new GetIPDialog(this); diff --git a/src/systemsettingform.cpp b/src/systemsettingform.cpp index 947a172..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() @@ -185,3 +191,11 @@ void systemSettingForm::saveServersInfo() //qIfConfig(lhost); } + +void systemSettingForm::changeEvent(QEvent* event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + } +} \ No newline at end of file diff --git a/src/systemsettingform.h b/src/systemsettingform.h index 1e4ff87..157fc08 100644 --- a/src/systemsettingform.h +++ b/src/systemsettingform.h @@ -20,6 +20,9 @@ public: explicit systemSettingForm(QWidget *parent = nullptr); ~systemSettingForm(); +protected: + void changeEvent(QEvent* event); + private: Ui::systemSettingForm *ui; SelectDialog* sd_protocal = nullptr; diff --git a/src/systemsettingform.ui b/src/systemsettingform.ui index c686874..1e1fbf1 100644 --- a/src/systemsettingform.ui +++ b/src/systemsettingform.ui @@ -6,7 +6,7 @@ 0 0 - 527 + 619 612 diff --git a/src/tabformwidget.cpp b/src/tabformwidget.cpp index df20741..2e294d5 100644 --- a/src/tabformwidget.cpp +++ b/src/tabformwidget.cpp @@ -1,7 +1,7 @@ #include "tabformwidget.h" #include "ui_tabformwidget.h" #include -#include +#include "components/RollingMessageWidget.h" #include "event/EventCenter.h" #if defined(_MSC_VER) && (_MSC_VER >= 1600) diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts deleted file mode 100644 index 0fc4d95..0000000 --- a/src/translations/en_US.ts +++ /dev/null @@ -1,2291 +0,0 @@ - - - - - AbstractButtonSection - - - - AbstractButton - - - - - - Text - - - - - - The text displayed on the button. - - - - - - Display - - - - - - Determines how the icon and text are displayed within the button. - - - - - - Checkable - - - - - - Whether the button is checkable. - - - - - - Checked - - - - - - Whether the button is checked. - - - - - - Exclusive - - - - - - Whether the button is exclusive. - - - - - - Repeat - - - - - - Whether the button repeats while pressed and held down. - - - - - AccountFormDialog - - - Account - - - - - User ID - - - - - Name - - - - - Password - - - - - Change Password - - - - - - Logout - - - - - AdminSettingForm - - - General - - - - - Account Manage - - - - - System Setting - - - - - System Information - - - - - Operation Log - - - - - About - - - - - BusyIndicatorSpecifics - - - - BusyIndicator - - - - - - Running - - - - - - Whether the busy indicator is currently indicating activity. - - - - - ButtonSection - - - - Button - - - - - - AutoRepeat - - - - - - Whether the button repeats pressed(), released() and clicked() signals while the button is pressed and held down. - - - - - - Flat - - - - - - Whether the button is flat. - - - - - - Highlighted - - - - - - Whether the button is highlighted. - - - - - ChangePasswordFormDialog - - - Change Password - - - - - Current Password - - - - - New Password - - - - - Confirm Password - - - - - Please enter your old password! - - - - - New password should at least 6 characters! - - - - - Wrong password! - - - - - Your new password does not match! - - - - - Database update error! - - - - - CheckBoxSpecifics - - - - CheckBox - - - - - CheckDelegateSpecifics - - - - CheckDelegate - - - - - CheckSection - - - - Check State - - - - - - The current check state. - - - - - - Tri-state - - - - - - Whether the checkbox has three states. - - - - - CircularGaugeSpecifics - - - - CircularGauge - - - - - - - - Value - - - - - - - - Minimum Value - - - - - - - - Maximum Value - - - - - - - - Step Size - - - - - ComboBoxSpecifics - - - - ComboBox - - - - - - Text Role - - - - - - The model role used for displaying text. - - - - - - Current - - - - - - The index of the current item. - - - - - - Editable - - - - - - Whether the combo box is editable. - - - - - - Flat - - - - - - Whether the combo box button is flat. - - - - - - DisplayText - - - - - - Holds the text that is displayed on the combo box button. - - - - - ContainerSection - - - - Container - - - - - - Current - - - - - - The index of the current item. - - - - - ControlSection - - - - Control - - - - - - Enabled - - - - - - Whether the control is enabled. - - - - - - Focus Policy - - - - - - Focus policy of the control. - - - - - - Hover - - - - - - Whether control accepts hover evets. - - - - - - Spacing - - - - - - Spacing between internal elements of the control. - - - - - - Wheel - - - - - - Whether control accepts wheel evets. - - - - - DefaultColorDialog - - - - Hue - - - - - - Saturation - - - - - - Luminosity - - - - - - Alpha - - - - - - Cancel - - - - - - OK - - - - - DefaultDialogWrapper - - - - Show Details... - - - - - DefaultFileDialog - - - - Go up to the folder containing this one - - - - - - Remove favorite - - - - - - Add the current directory as a favorite - - - - - - Filename - - - - - - Type - file type (extension) - - - - - - Size - file size - - - - - - Modified - last-modified time - - - - - - Accessed - last-accessed time - - - - - - Cancel - - - - - - Choose - - - - - - Open - - - - - - Save - - - - - DefaultFontDialog - - - - Font - - - - - - - - Weight - - - - - - - - Size - - - - - - Font Family - - - - - - Thin - - - - - - ExtraLight - - - - - - Light - - - - - - Normal - - - - - - Medium - - - - - - DemiBold - - - - - - Bold - - - - - - ExtraBold - - - - - - Black - - - - - - Style - - - - - - Italic - - - - - - Underline - - - - - - Overline - - - - - - Strikeout - - - - - - Writing System - - - - - - Sample - - - - - - Cancel - - - - - - OK - - - - - DefaultMessageDialog - - - - OK - - - - - - Open - - - - - - Save - - - - - - Save All - - - - - - Retry - - - - - - Ignore - - - - - - Apply - - - - - - Yes - - - - - - Yes to All - - - - - - No - - - - - - No to All - - - - - - Discard - - - - - - Reset - - - - - - Restore Defaults - - - - - - Cancel - - - - - - Abort - - - - - - Close - - - - - - Show Details... - - - - - - Help - - - - - - Hide Details - - - - - DelayButtonSpecifics - - - - - - DelayButton - - - - - - - - - - Delay - - - - - - The delay in milliseconds. - - - - - - - - Text - - - - - DialSpecifics - - - - - - Dial - - - - - - - - - - Value - - - - - - The current value of the dial. - - - - - - From - - - - - - The starting value of the dial range. - - - - - - To - - - - - - The ending value of the dial range. - - - - - - - - - - Step Size - - - - - - The step size of the dial. - - - - - - Snap Mode - - - - - - The snap mode of the dial. - - - - - - Live - - - - - - Whether the dial provides live value updates. - - - - - - - - Minimum Value - - - - - - - - Maximum Value - - - - - - - - Tickmarks Visible - - - - - EditMenu_base - - - - &Undo - - - - - - &Redo - - - - - - Cu&t - - - - - - &Copy - - - - - - &Paste - - - - - - Delete - - - - - - Clear - - - - - - Select All - - - - - EditPatientForm - - - - - Form - - - - - - - ID - - - - - - - Name - - - - - - - Sex - - - - - - - Date Of Birth - - - - - - - Comment - - - - - GUIMessageDialog - - - - - Dialog - - - - - - - ... - - - - - GaugeSpecifics - - - - Gauge - - - - - - - - Value - - - - - - - - Minimum Value - - - - - - - - Maximum Value - - - - - GeneralForm - - - Language - - - - - Institution Name - - - - - Institution Addr - - - - - Lock Screen Timeout - - - - - GroupBoxSpecifics - - - - GroupBox - - - - - - Title - - - - - - The title of the group box. - - - - - InputObject - - - - - Form - - - - - ItemDelegateSection - - - - ItemDelegate - - - - - - Highlighted - - - - - - Whether the delegate is highlighted. - - - - - LabelSpecifics - - - - - - Text Color - - - - - - - - Style Color - - - - - LoginWindow - - - Username - - - - - Password - - - - - MainWindow - - - - - MainWindow - - - - - PaddingSection - - - - Padding - - - - - - Top - - - - - - Padding between the content and the top edge of the control. - - - - - - Left - - - - - - Padding between the content and the left edge of the control. - - - - - - Right - - - - - - Padding between the content and the right edge of the control. - - - - - - Bottom - - - - - - Padding between the content and the bottom edge of the control. - - - - - PageIndicatorSpecifics - - - - PageIndicator - - - - - - Count - - - - - - The number of pages. - - - - - - Current - - - - - - The index of the current page. - - - - - PageSpecifics - - - - Page - - - - - - Title - - - - - - Title of the page. - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - PaneSection - - - - Pane - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - PatientInformationForm - - - - - Form - - - - - - - Patient Information - - - - - - - <html><head/><body><p>PatientID:</p></body></html> - - - - - - - Someone Somebody - - - - - - - 2021/11/11 - - - - - - - Female - - - - - - - Acc# 27812398 - - - - - - - Current Protocol - - - - - - - LEFT ONLY - - - - - PictureSpecifics - - - - Picture - - - - - - - - Source - - - - - - - - Color - - - - - PieMenuSpecifics - - - - PieMenu - - - - - - - - Trigger Mode - - - - - ProgressBarSpecifics - - - - ProgressBar - - - - - - Indeterminate - - - - - - Whether the progress is indeterminate. - - - - - - Value - - - - - - The current value of the progress. - - - - - - From - - - - - - The starting value for the progress. - - - - - - To - - - - - - The ending value for the progress. - - - - - RangeSliderSpecifics - - - - RangeSlider - - - - - - First Value - - - - - - The value of the first range slider handle. - - - - - - Second Value - - - - - - The value of the second range slider handle. - - - - - - From - - - - - - The starting value of the range slider range. - - - - - - To - - - - - - The ending value of the range slider range. - - - - - - Step Size - - - - - - The step size of the range slider. - - - - - - Snap Mode - - - - - - The snap mode of the range slider. - - - - - - Orientation - - - - - - The orientation of the range slider. - - - - - - Live - - - - - - Whether the range slider provides live value updates. - - - - - RoundButtonSpecifics - - - - RoundButton - - - - - - Radius - - - - - - Radius of the button. - - - - - ScrollViewSpecifics - - - - ScrollView - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - SliderSpecifics - - - - Slider - - - - - - Value - - - - - - The current value of the slider. - - - - - - From - - - - - - The starting value of the slider range. - - - - - - To - - - - - - The ending value of the slider range. - - - - - - Step Size - - - - - - The step size of the slider. - - - - - - Snap Mode - - - - - - The snap mode of the slider. - - - - - - Orientation - - - - - - The orientation of the slider. - - - - - - Live - - - - - - Whether the slider provides live value updates. - - - - - SpinBoxSpecifics - - - - SpinBox - - - - - - Value - - - - - - The current value of the spinbox. - - - - - - From - - - - - - The starting value of the spinbox range. - - - - - - To - - - - - - The ending value of the spinbox range. - - - - - - Step Size - - - - - - The step size of the spinbox. - - - - - - Editable - - - - - - Whether the spinbox is editable. - - - - - StatusIndicatorSpecifics - - - - StatusIndicator - - - - - - - - Active - - - - - - - - Color - - - - - SwipeViewSpecifics - - - - SwipeView - - - - - - Interactive - - - - - - Whether the view is interactive. - - - - - - Orientation - - - - - - Orientation of the view. - - - - - TabBarSpecifics - - - - TabBar - - - - - - Position - - - - - - Position of the tabbar. - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - TabFormWidget - - - - - Form - - - - - - - LOGO - - - - - - - TextLabel - - - - - - - <html><head/><body><p>Message from DAQ and device.</p></body></html> - - - - - 浙江衡玖医疗科技 - - - - - 浙江大学医学院附属第二医院 - - - - - °C - - - - - TextAreaSpecifics - - - - TextArea - - - - - - Placeholder - - - - - - Placeholder text displayed when the editor is empty. - - - - - TextFieldSpecifics - - - - TextField - - - - - - Placeholder - - - - - - Placeholder text displayed when the editor is empty. - - - - - ToggleButtonSpecifics - - - - ToggleButton - - - - - - - - Text - - - - - - - - Checked - - - - - ToolBarSpecifics - - - - ToolBar - - - - - - Position - - - - - - Position of the toolbar. - - - - - ToolSeparatorSpecifics - - - - ToolSeparator - - - - - - Orientation - - - - - - The orientation of the separator. - - - - - TumblerSpecifics - - - - Tumbler - - - - - - Visible Count - - - - - - The count of visible items. - - - - - - Current - - - - - - The index of the current item. - - - - - - Wrap - - - - - - Whether the tumbler wrap. - - - - - UserOperationLogForm - - - Log Date: - - - - - systemSettingForm - - - Default Protocal - - - - - Default Worklist Filter - - - - diff --git a/src/translations/zh_CN.qm b/src/translations/zh_CN.qm index 7632b6a..2a1117d 100644 Binary files a/src/translations/zh_CN.qm and b/src/translations/zh_CN.qm differ diff --git a/src/translations/zh_CN.ts b/src/translations/zh_CN.ts deleted file mode 100644 index c137298..0000000 --- a/src/translations/zh_CN.ts +++ /dev/null @@ -1,2291 +0,0 @@ - - - - - AbstractButtonSection - - - - AbstractButton - - - - - - Text - - - - - - The text displayed on the button. - - - - - - Display - - - - - - Determines how the icon and text are displayed within the button. - - - - - - Checkable - - - - - - Whether the button is checkable. - - - - - - Checked - - - - - - Whether the button is checked. - - - - - - Exclusive - - - - - - Whether the button is exclusive. - - - - - - Repeat - - - - - - Whether the button repeats while pressed and held down. - - - - - AccountFormDialog - - - Account - 用户名 - - - - User ID - 用户ID - - - - Name - 姓名 - - - - Password - 密码 - - - - Change Password - 修改密码 - - - - - Logout - 登出 - - - - AdminSettingForm - - - General - 通用 - - - - Account Manage - 用户管理 - - - - System Setting - 系统设置 - - - - System Information - 系统信息 - - - - Operation Log - 操作日志 - - - - About - 关于 - - - - BusyIndicatorSpecifics - - - - BusyIndicator - - - - - - Running - - - - - - Whether the busy indicator is currently indicating activity. - - - - - ButtonSection - - - - Button - - - - - - AutoRepeat - - - - - - Whether the button repeats pressed(), released() and clicked() signals while the button is pressed and held down. - - - - - - Flat - - - - - - Whether the button is flat. - - - - - - Highlighted - - - - - - Whether the button is highlighted. - - - - - ChangePasswordFormDialog - - - Change Password - 修改密码 - - - - Current Password - - - - - New Password - - - - - Confirm Password - - - - - Please enter your old password! - - - - - New password should at least 6 characters! - - - - - Wrong password! - - - - - Your new password does not match! - - - - - Database update error! - - - - - CheckBoxSpecifics - - - - CheckBox - - - - - CheckDelegateSpecifics - - - - CheckDelegate - - - - - CheckSection - - - - Check State - - - - - - The current check state. - - - - - - Tri-state - - - - - - Whether the checkbox has three states. - - - - - CircularGaugeSpecifics - - - - CircularGauge - - - - - - - - Value - - - - - - - - Minimum Value - - - - - - - - Maximum Value - - - - - - - - Step Size - - - - - ComboBoxSpecifics - - - - ComboBox - - - - - - Text Role - - - - - - The model role used for displaying text. - - - - - - Current - - - - - - The index of the current item. - - - - - - Editable - - - - - - Whether the combo box is editable. - - - - - - Flat - - - - - - Whether the combo box button is flat. - - - - - - DisplayText - - - - - - Holds the text that is displayed on the combo box button. - - - - - ContainerSection - - - - Container - - - - - - Current - - - - - - The index of the current item. - - - - - ControlSection - - - - Control - - - - - - Enabled - - - - - - Whether the control is enabled. - - - - - - Focus Policy - - - - - - Focus policy of the control. - - - - - - Hover - - - - - - Whether control accepts hover evets. - - - - - - Spacing - - - - - - Spacing between internal elements of the control. - - - - - - Wheel - - - - - - Whether control accepts wheel evets. - - - - - DefaultColorDialog - - - - Hue - - - - - - Saturation - - - - - - Luminosity - - - - - - Alpha - - - - - - Cancel - - - - - - OK - - - - - DefaultDialogWrapper - - - - Show Details... - - - - - DefaultFileDialog - - - - Go up to the folder containing this one - - - - - - Remove favorite - - - - - - Add the current directory as a favorite - - - - - - Filename - - - - - - Type - file type (extension) - - - - - - Size - file size - - - - - - Modified - last-modified time - - - - - - Accessed - last-accessed time - - - - - - Cancel - - - - - - Choose - - - - - - Open - - - - - - Save - - - - - DefaultFontDialog - - - - Font - - - - - - - - Weight - - - - - - - - Size - - - - - - Font Family - - - - - - Thin - - - - - - ExtraLight - - - - - - Light - - - - - - Normal - - - - - - Medium - - - - - - DemiBold - - - - - - Bold - - - - - - ExtraBold - - - - - - Black - - - - - - Style - - - - - - Italic - - - - - - Underline - - - - - - Overline - - - - - - Strikeout - - - - - - Writing System - - - - - - Sample - - - - - - Cancel - - - - - - OK - - - - - DefaultMessageDialog - - - - OK - - - - - - Open - - - - - - Save - - - - - - Save All - - - - - - Retry - - - - - - Ignore - - - - - - Apply - - - - - - Yes - - - - - - Yes to All - - - - - - No - - - - - - No to All - - - - - - Discard - - - - - - Reset - - - - - - Restore Defaults - - - - - - Cancel - - - - - - Abort - - - - - - Close - - - - - - Show Details... - - - - - - Help - - - - - - Hide Details - - - - - DelayButtonSpecifics - - - - - - DelayButton - - - - - - - - - - Delay - - - - - - The delay in milliseconds. - - - - - - - - Text - - - - - DialSpecifics - - - - - - Dial - - - - - - - - - - Value - - - - - - The current value of the dial. - - - - - - From - - - - - - The starting value of the dial range. - - - - - - To - - - - - - The ending value of the dial range. - - - - - - - - - - Step Size - - - - - - The step size of the dial. - - - - - - Snap Mode - - - - - - The snap mode of the dial. - - - - - - Live - - - - - - Whether the dial provides live value updates. - - - - - - - - Minimum Value - - - - - - - - Maximum Value - - - - - - - - Tickmarks Visible - - - - - EditMenu_base - - - - &Undo - - - - - - &Redo - - - - - - Cu&t - - - - - - &Copy - - - - - - &Paste - - - - - - Delete - - - - - - Clear - - - - - - Select All - - - - - EditPatientForm - - - - - Form - - - - - - - ID - - - - - - - Name - 姓名 - - - - - - Sex - - - - - - - Date Of Birth - - - - - - - Comment - - - - - GUIMessageDialog - - - - - Dialog - - - - - - - ... - - - - - GaugeSpecifics - - - - Gauge - - - - - - - - Value - - - - - - - - Minimum Value - - - - - - - - Maximum Value - - - - - GeneralForm - - - Language - 语言 - - - - Institution Name - 机构名称 - - - - Institution Addr - 机构地址 - - - - Lock Screen Timeout - 锁屏时间 - - - - GroupBoxSpecifics - - - - GroupBox - - - - - - Title - - - - - - The title of the group box. - - - - - InputObject - - - - - Form - - - - - ItemDelegateSection - - - - ItemDelegate - - - - - - Highlighted - - - - - - Whether the delegate is highlighted. - - - - - LabelSpecifics - - - - - - Text Color - - - - - - - - Style Color - - - - - LoginWindow - - - Username - 用户名 - - - - Password - 密码 - - - - MainWindow - - - - - MainWindow - - - - - PaddingSection - - - - Padding - - - - - - Top - - - - - - Padding between the content and the top edge of the control. - - - - - - Left - - - - - - Padding between the content and the left edge of the control. - - - - - - Right - - - - - - Padding between the content and the right edge of the control. - - - - - - Bottom - - - - - - Padding between the content and the bottom edge of the control. - - - - - PageIndicatorSpecifics - - - - PageIndicator - - - - - - Count - - - - - - The number of pages. - - - - - - Current - - - - - - The index of the current page. - - - - - PageSpecifics - - - - Page - - - - - - Title - - - - - - Title of the page. - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - PaneSection - - - - Pane - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - PatientInformationForm - - - - - Form - - - - - - - Patient Information - - - - - - - <html><head/><body><p>PatientID:</p></body></html> - - - - - - - Someone Somebody - - - - - - - 2021/11/11 - - - - - - - Female - - - - - - - Acc# 27812398 - - - - - - - Current Protocol - - - - - - - LEFT ONLY - - - - - PictureSpecifics - - - - Picture - - - - - - - - Source - - - - - - - - Color - - - - - PieMenuSpecifics - - - - PieMenu - - - - - - - - Trigger Mode - - - - - ProgressBarSpecifics - - - - ProgressBar - - - - - - Indeterminate - - - - - - Whether the progress is indeterminate. - - - - - - Value - - - - - - The current value of the progress. - - - - - - From - - - - - - The starting value for the progress. - - - - - - To - - - - - - The ending value for the progress. - - - - - RangeSliderSpecifics - - - - RangeSlider - - - - - - First Value - - - - - - The value of the first range slider handle. - - - - - - Second Value - - - - - - The value of the second range slider handle. - - - - - - From - - - - - - The starting value of the range slider range. - - - - - - To - - - - - - The ending value of the range slider range. - - - - - - Step Size - - - - - - The step size of the range slider. - - - - - - Snap Mode - - - - - - The snap mode of the range slider. - - - - - - Orientation - - - - - - The orientation of the range slider. - - - - - - Live - - - - - - Whether the range slider provides live value updates. - - - - - RoundButtonSpecifics - - - - RoundButton - - - - - - Radius - - - - - - Radius of the button. - - - - - ScrollViewSpecifics - - - - ScrollView - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - SliderSpecifics - - - - Slider - - - - - - Value - - - - - - The current value of the slider. - - - - - - From - - - - - - The starting value of the slider range. - - - - - - To - - - - - - The ending value of the slider range. - - - - - - Step Size - - - - - - The step size of the slider. - - - - - - Snap Mode - - - - - - The snap mode of the slider. - - - - - - Orientation - - - - - - The orientation of the slider. - - - - - - Live - - - - - - Whether the slider provides live value updates. - - - - - SpinBoxSpecifics - - - - SpinBox - - - - - - Value - - - - - - The current value of the spinbox. - - - - - - From - - - - - - The starting value of the spinbox range. - - - - - - To - - - - - - The ending value of the spinbox range. - - - - - - Step Size - - - - - - The step size of the spinbox. - - - - - - Editable - - - - - - Whether the spinbox is editable. - - - - - StatusIndicatorSpecifics - - - - StatusIndicator - - - - - - - - Active - - - - - - - - Color - - - - - SwipeViewSpecifics - - - - SwipeView - - - - - - Interactive - - - - - - Whether the view is interactive. - - - - - - Orientation - - - - - - Orientation of the view. - - - - - TabBarSpecifics - - - - TabBar - - - - - - Position - - - - - - Position of the tabbar. - - - - - - Content Width - - - - - - Content height used for calculating the total implicit width. - - - - - - Content Height - - - - - - Content height used for calculating the total implicit height. - - - - - TabFormWidget - - - - - Form - - - - - - - LOGO - - - - - - - TextLabel - - - - - - - <html><head/><body><p>Message from DAQ and device.</p></body></html> - - - - - 浙江衡玖医疗科技 - - - - - 浙江大学医学院附属第二医院 - - - - - °C - - - - - TextAreaSpecifics - - - - TextArea - - - - - - Placeholder - - - - - - Placeholder text displayed when the editor is empty. - - - - - TextFieldSpecifics - - - - TextField - - - - - - Placeholder - - - - - - Placeholder text displayed when the editor is empty. - - - - - ToggleButtonSpecifics - - - - ToggleButton - - - - - - - - Text - - - - - - - - Checked - - - - - ToolBarSpecifics - - - - ToolBar - - - - - - Position - - - - - - Position of the toolbar. - - - - - ToolSeparatorSpecifics - - - - ToolSeparator - - - - - - Orientation - - - - - - The orientation of the separator. - - - - - TumblerSpecifics - - - - Tumbler - - - - - - Visible Count - - - - - - The count of visible items. - - - - - - Current - - - - - - The index of the current item. - - - - - - Wrap - - - - - - Whether the tumbler wrap. - - - - - UserOperationLogForm - - - Log Date: - - - - - systemSettingForm - - - Default Protocal - - - - - Default Worklist Filter - - - -