This commit is contained in:
xueyan hu
2021-12-21 16:15:07 +08:00
parent 595632aef5
commit 9b2b6d8838
11 changed files with 1501 additions and 1478 deletions

View File

@@ -35,6 +35,11 @@ file(GLOB project_uis ./src/*.ui)
qt5_wrap_ui(ui_FILES ${project_uis})
file(GLOB project_res ./src/*.qrc)
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)
@@ -45,6 +50,7 @@ set(cpp_source_all ${project_headers} ${project_cpps} ${project_cxx} ${project_r
qt5_create_translation(QM_FILES ${cpp_source_all} ${TS_FILES})
add_executable(${PROJECT_NAME} ${cpp_source_all} ${ui_FILES} ${QM_FILES} )
add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_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)

View File

@@ -1,5 +1,6 @@
#include "generalform.h"
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
@@ -21,7 +22,9 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent)
layout->addWidget(lanHeader);
QHBoxLayout* lanHeaderLayout = new QHBoxLayout(lanHeader);
lanHeaderLayout->addWidget(new QLabel(tr("Language")));
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));
@@ -101,8 +104,15 @@ void GeneralForm::changeEvent(QEvent* event)
{
if (event->type() == QEvent::LanguageChange)
{
qDebug() << "change language";
//this->retranslateUi();
lbl_lan->setText(tr("Language"));
}
QWidget::changeEvent(event);
}
}
void GeneralForm::retranslateUi()
{
//lbl_lan->setText(QApplication::translate("GeneralForm", "Language", nullptr));
lbl_lan->setText(tr("Language"));
} // retranslateUi

View File

@@ -5,6 +5,7 @@
class QPushButton;
class QVBoxLayout;
class SelectDialog;
class QLabel;
class GeneralForm : public QWidget
{
@@ -19,8 +20,11 @@ protected:
void changeEvent(QEvent* event);
private:
void retranslateUi();
QVBoxLayout* layout = nullptr;
SelectDialog* dialog = nullptr;
QLabel* lbl_lan = nullptr;
};
#endif // GENERALFORM_H

View File

@@ -12,15 +12,15 @@ GetIPDialog::GetIPDialog(QWidget* parent, Qt::WindowFlags f) : GUIFormBaseDialog
setWindowModality(Qt::WindowModal);
QFormLayout* form = new QFormLayout(formWidget);
QString value1 = QString("IP Address");
QString value1 = QString(tr("IP Address"));
_ip = new QLineEdit(this);
form->addRow(value1, _ip);
QString value2 = QString("Netmask");
QString value2 = QString(tr("Netmask"));
_mask = new QLineEdit(this);
form->addRow(value2, _mask);
lbl_error = new QLabel(this);
lbl_error->setObjectName("warn");
lbl_error->setObjectName(tr("warn"));
form->addRow("", lbl_error);
}

View File

@@ -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);

View File

@@ -185,3 +185,11 @@ void systemSettingForm::saveServersInfo()
//qIfConfig(lhost);
}
void systemSettingForm::changeEvent(QEvent* event)
{
if (event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this);
}
}

View File

@@ -20,6 +20,9 @@ public:
explicit systemSettingForm(QWidget *parent = nullptr);
~systemSettingForm();
protected:
void changeEvent(QEvent* event);
private:
Ui::systemSettingForm *ui;
SelectDialog* sd_protocal = nullptr;

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>527</width>
<width>619</width>
<height>612</height>
</rect>
</property>

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff