From 00068832a203fa1da21641f33a50effe18cbb61d Mon Sep 17 00:00:00 2001 From: alainchen Date: Sat, 13 Feb 2021 21:44:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eda_qt/eda_qt.pro | 2 ++ src/eda_qt/mainwindow.cpp | 20 ++++++++++++++++++++ src/eda_qt/mainwindow.h | 4 ++++ src/eda_qt/mainwindow.ui | 36 +++++++++++++++++++++++++++++++++--- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/eda_qt/eda_qt.pro b/src/eda_qt/eda_qt.pro index d021934..cc000c2 100644 --- a/src/eda_qt/eda_qt.pro +++ b/src/eda_qt/eda_qt.pro @@ -17,6 +17,8 @@ RC_ICONS = icon.ico # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +TRANSLATIONS += English.ts\ + Chinese.ts SOURCES += \ about_dialog.cpp \ diff --git a/src/eda_qt/mainwindow.cpp b/src/eda_qt/mainwindow.cpp index fdc1a8e..3e0d1a3 100644 --- a/src/eda_qt/mainwindow.cpp +++ b/src/eda_qt/mainwindow.cpp @@ -1110,3 +1110,23 @@ void MainWindow::on_actionAdd_to_popular_triggered() } } } + + + +void MainWindow::on_actionChinese_triggered() +{ + QTranslator m; + QString currentPath = QCoreApplication::applicationDirPath(); + m.load(currentPath+"/lang/Chinese.qm"); + qApp->installTranslator(&m); + this->ui->retranslateUi(this); +} + +void MainWindow::on_actionEnglish_triggered() +{ + QString currentPath = QCoreApplication::applicationDirPath(); + QTranslator m; + m.load(currentPath+"/lang/English.qm"); + qApp->installTranslator(&m); + this->ui->retranslateUi(this); +} diff --git a/src/eda_qt/mainwindow.h b/src/eda_qt/mainwindow.h index 99c3d91..c79f6e1 100644 --- a/src/eda_qt/mainwindow.h +++ b/src/eda_qt/mainwindow.h @@ -81,6 +81,10 @@ private slots: void on_actionAdd_to_popular_triggered(); + void on_actionChinese_triggered(); + + void on_actionEnglish_triggered(); + private: Ui::MainWindow *ui; diff --git a/src/eda_qt/mainwindow.ui b/src/eda_qt/mainwindow.ui index 67e2e4b..5b172a2 100644 --- a/src/eda_qt/mainwindow.ui +++ b/src/eda_qt/mainwindow.ui @@ -137,7 +137,7 @@ - 1 + 0 @@ -149,7 +149,7 @@ - Page 1 + Popular @@ -162,7 +162,7 @@ - System + Examples @@ -377,9 +377,29 @@ p, li { white-space: pre-wrap; } + + + Tools + + + + Preferences + + + + Language + + + + + + + + + @@ -458,6 +478,16 @@ p, li { white-space: pre-wrap; } Add to popular + + + Chinese + + + + + English + +