diff --git a/runner17/Report.exe b/runner17/Report.exe index c9bdc0e..8aacd04 100644 Binary files a/runner17/Report.exe and b/runner17/Report.exe differ diff --git a/runner17/Reportd.exe b/runner17/Reportd.exe index 439d51d..60d04cc 100644 Binary files a/runner17/Reportd.exe and b/runner17/Reportd.exe differ diff --git a/runner17/language/English/report_en.qm b/runner17/language/English/report_en.qm new file mode 100644 index 0000000..8ef8825 Binary files /dev/null and b/runner17/language/English/report_en.qm differ diff --git a/runner17/lpMaind.dll b/runner17/lpMaind.dll index 6f72e54..0e79cda 100644 Binary files a/runner17/lpMaind.dll and b/runner17/lpMaind.dll differ diff --git a/tpvs17/Report/Report.vcxproj b/tpvs17/Report/Report.vcxproj index cc384b5..291c904 100644 --- a/tpvs17/Report/Report.vcxproj +++ b/tpvs17/Report/Report.vcxproj @@ -155,6 +155,9 @@ .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtSql;$(QTDIR)\include\QtWidgets + + + diff --git a/tpvs17/Report/Report.vcxproj.filters b/tpvs17/Report/Report.vcxproj.filters index 2474d7f..91e28e8 100644 --- a/tpvs17/Report/Report.vcxproj.filters +++ b/tpvs17/Report/Report.vcxproj.filters @@ -31,6 +31,11 @@ {254918ee-db1e-4bc7-a132-e121174a9976} + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + false + @@ -96,4 +101,9 @@ db + + + Translation Files + + \ No newline at end of file diff --git a/tpvs17/Report/qcheckdatadlg.cpp b/tpvs17/Report/qcheckdatadlg.cpp index 1101983..395042c 100644 --- a/tpvs17/Report/qcheckdatadlg.cpp +++ b/tpvs17/Report/qcheckdatadlg.cpp @@ -2,11 +2,21 @@ #include "qstandarditemmodel.h" #include "qmessagebox.h" #include "qfontmetrics.h" +#include +#include + #pragma execution_character_set("utf-8") QCheckDataDlg::QCheckDataDlg(QWidget *parent) : QDialog(parent), m_db(NULL), nPrevNum(0), nTotlaNumber(0) { ui.setupUi(this); + + QString m_AppPath = QApplication::applicationDirPath(); + QString m_CfgPath = m_AppPath + QString("//user//systemConfig.ini"); + QSettings setting(m_CfgPath, QSettings::IniFormat); + QString m_CurLanguage = setting.value("language/select", "Chinese").toString(); + SetLanguage(m_CurLanguage); + m_ViewImg = new QTpGraphView; connect(ui.m_pbCheck, SIGNAL(clicked()), this, SLOT(onCheckOutData())); connect(ui.Prev_checkShengchang, SIGNAL(clicked()), this, SLOT(onChenckButton())); @@ -296,6 +306,14 @@ void QCheckDataDlg::setPageShow(int page,int totalPage) ui.showPage_Label_Checkdata->setText(str); } +void QCheckDataDlg::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui.retranslateUi(this); + } +} + Q_SLOT void QCheckDataDlg::onTBUI_ItemClick(const QModelIndex & index) { QModelIndex nindex = m_tableModel->index(index.row(), 0); @@ -368,4 +386,84 @@ Q_SLOT void QCheckDataDlg::onSlowPixmap(QSqlQuery sql) nFlag = false; } +//======系统翻译相关 +void QCheckDataDlg::SearchQmFile(const QString & strDir) +{ + QDir dir(strDir); + if (!dir.exists()) + { + return; + } + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); // 文件夹优先 + // 转换成一个List + QFileInfoList list = dir.entryInfoList(); + if (list.size() < 1) + { + return; + } + int i = 0; + do + { + QFileInfo fileInfo = list.at(i); + QString tt = fileInfo.fileName(); + // 如果是文件夹 + bool bisDir = fileInfo.isDir(); + if (bisDir) + { + SearchQmFile(fileInfo.filePath()); + } + else + { + bool bQm = fileInfo.fileName().endsWith(".qm"); + SetTranslator(fileInfo.filePath()); + } + i++; + } while (i < list.size()); +} +void QCheckDataDlg::rmTranslator() +{ + if (m_VecTranPtr.size() > 0) + { + while (m_VecTranPtr.size()) + { + QTranslator *pVa = m_VecTranPtr.takeFirst(); + qApp->removeTranslator(pVa); + delete pVa; + pVa = NULL; + } + } +} + +void QCheckDataDlg::SetLanguage(QString strLangage) +{ + QString strDirPath = QString(QCoreApplication::applicationDirPath() + "/language/"); + QString translatorFileName = strLangage; + if (!translatorFileName.isEmpty()) + { + rmTranslator(); + QLocale::setDefault(QLocale(translatorFileName)); + + QString transDir = strDirPath + translatorFileName; + SearchQmFile(transDir); + } +} +void QCheckDataDlg::SetTranslator(const QString strPath) +{ + if (strPath.isEmpty()) + { + return; + } + QTranslator *pTrans = new QTranslator; + if (pTrans->load(strPath)) // 如果加载成功 + { + qApp->installTranslator(pTrans); + m_VecTranPtr.append(pTrans); + } + else + { + delete pTrans; + pTrans = NULL; + } +} diff --git a/tpvs17/Report/qcheckdatadlg.h b/tpvs17/Report/qcheckdatadlg.h index 260eb54..406178b 100644 --- a/tpvs17/Report/qcheckdatadlg.h +++ b/tpvs17/Report/qcheckdatadlg.h @@ -10,6 +10,8 @@ #include "qdatetimeedit.h" #include "QTextBrowser.h" #include "cunstomgraphview.h" +#include + class QCheckDataDlg : public QDialog { Q_OBJECT @@ -25,6 +27,12 @@ private: Q_SLOT void onCheckOutData(); Q_SLOT void onTBUI_ItemClick(const QModelIndex & index); Q_SLOT void onSlowPixmap(QSqlQuery sql); + + + void SearchQmFile(const QString & strDir); + void rmTranslator(); + void SetLanguage(QString strLangage); + void SetTranslator(const QString strPath); private: int getLimitNumber(); int getTotalNumber(); @@ -36,6 +44,8 @@ private: void updateModelShowLog(QSqlQuery &sql); void onCheckOutData(int nLimitNum, int nPrenum); void setPageShow(int page, int totalPage); +protected: + virtual void changeEvent(QEvent *event); private: Ui::QCheckDataDlg ui; @@ -53,6 +63,9 @@ private: int nTotlaNumber; QTpGraphView *m_ViewImg{ nullptr }; + + QVector m_VecTranPtr; + QString m_strCurLanguage{ "Chinese" }; }; #endif // QCHECKDATADLG_H diff --git a/tpvs17/Report/report_en.ts b/tpvs17/Report/report_en.ts new file mode 100644 index 0000000..71e5913 --- /dev/null +++ b/tpvs17/Report/report_en.ts @@ -0,0 +1,183 @@ + + + + + QCheckDataDlg + + + 检测记录查询 + History Recode + + + + 查询操作 + operation + + + + + 全部 + All + + + + error + + + + + 结束时间: + End Time: + + + + 显示: + Error Type: + + + + 起始时间: + Start Time: + + + + 工位: + Station: + + + + 查询 + Check + + + + 显示数据数(条) + Show Recodes + + + + 50 + + + + + 上一页 + Previous + + + + + + TextLabel + + + + + 下一页 + Next + + + + + 统计 + Statics + + + + 统计当前设置的查询时间记录总数 + The total number of query time records is collected + + + + QObject + + + 时间 + Time + + + + 型号 + Model + + + + matchScore + + + + + BenchMark + + + + + Angle + + + + + errorType + + + + + resultTip + + + + + 工位 + Station + + + + 共显示%1条记录 + with %1 recodes + + + + + + + + + + + 全部 + All + + + + + 提醒 + Info + + + + 已经是最后一页了 + This is the last page + + + + + 确认 + OK + + + + 已经是第一页了 + This is the first page + + + + 第%1页 共%2页 + %1,%2 + + + + 无图片(或图片已过期/已被删除) + No Image(Image Deleted) + + + diff --git a/tpvs17/lpMain/CMainWin.cpp b/tpvs17/lpMain/CMainWin.cpp index 4043722..bcb386c 100644 --- a/tpvs17/lpMain/CMainWin.cpp +++ b/tpvs17/lpMain/CMainWin.cpp @@ -133,9 +133,9 @@ CMainWin::CMainWin(QWidget *parent) m_TimerID_Status = startTimer(1000); - ui.actionSystem->setDisabled(true); - ui.actionTest->setDisabled(true); - ui.actionStandard->setDisabled(true); + //ui.actionSystem->setDisabled(true); + //ui.actionTest->setDisabled(true); + //ui.actionStandard->setDisabled(true); } CMainWin::~CMainWin()