From c5cb22ff346891dc2921fa5442ae754298e35a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E7=B3=96=E9=9B=AA=E7=8B=B8?= Date: Sat, 6 Apr 2024 20:08:34 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/App.pro | 3 + App/language_EN.ts | 184 +++++++++++++++++++++++++++++++- App/language_zh_CN.ts | 190 +++++++++++++++++++++++++++++++++- App/main.cpp | 6 +- App/resource.qrc | 4 + App/tcpclient.cpp | 22 ++-- App/tcpserver.cpp | 15 +-- App/uil_addchat.cpp | 4 +- App/uil_chatboxwidget.cpp | 34 +++--- App/uil_chatlist.cpp | 6 +- App/uil_loginwidget.cpp | 7 +- Tester/tst_PolyChatTester.cpp | 16 +-- 12 files changed, 440 insertions(+), 51 deletions(-) diff --git a/App/App.pro b/App/App.pro index 9c4cabb..5fdc24f 100644 --- a/App/App.pro +++ b/App/App.pro @@ -47,4 +47,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin RESOURCES += \ resource.qrc +TRANSLATIONS += language_zh_CN.ts \ + language_EN.ts + RC_ICONS = logo_fox.ico diff --git a/App/language_EN.ts b/App/language_EN.ts index 358b234..4fce81e 100644 --- a/App/language_EN.ts +++ b/App/language_EN.ts @@ -11,6 +11,7 @@ + Add new chat Add new chat @@ -34,6 +35,16 @@ Return Return + + + Warning + Warning + + + + Name can not be empty + Name can not be empty + ChatBoxWidget @@ -145,6 +156,7 @@ + Send file Send file @@ -200,7 +212,6 @@ - Number of online user: Number of online user: 0 Number of online user: @@ -240,6 +251,91 @@ IP IP address + + Chat %1 on port %2 + [Chat] %1 on port %2 + Chat %1 on port %2 + + + + Clean all message + Clean all message + + + + Are you sure you want to clear all messages? + Are you sure you want to clear all messages? + + + + + + Warning + Warning + + + + Can not save! +Message box is empty + Can not save! +Message box is empty + + + + Save file + Save file + + + + Save cancel + Save cancel + + + + Cancel sending file + Cancel sending file + + + + Error + Error + + + + File size cannot exceed 1Gb + File size cannot exceed 1GB + + + + File reception request + File reception request + + + + [%1] from group [%2] wants to send you a file, do you want to receive it? + +--------------------- +File information: +Name: %3 +Size: %4Kb + [%1] from group [%2] wants to send you a file, do you want to receive it? + +--------------------- +File information: +Name: %3 +Size: %4Kb + + + + %1 online + %1 online! + %1 online + + + + %1 left on %2 + %1 left on %2 + ChatList @@ -303,6 +399,21 @@ XXXX/XXXXXX + + + PolyChat Chat list + PolyChat Chat list + + + + Warning + Warning + + + + Chat with the same name already exists + Chat with the same name already exists + LoginWidget @@ -341,6 +452,16 @@ Return Return + + + PolyChat Login + PolyChat Login + + + + Name or Group number can not be empty + Name or Group number can not be empty + TcpClient @@ -442,6 +563,40 @@ Receipter Return + + + File receipter + File receipter + + + + Save file to + Save file to + + + + ERROR + ERROR + + + + File path is empty, you did not specify a save directory. +You can click on the `Save` button to receive the file again + File path is empty, you did not specify a save directory. +You can click on the `Save` button to receive the file again + + + + Cancel receive + Cancel receive + + + + If the file is not received, it will be stopped and disconnected. +Are you sure you want to cancel receiving files? + If the file is not received, it will be stopped and disconnected. +Are you sure you want to cancel receiving files? + TcpServer @@ -521,5 +676,32 @@ Receipter Esc + + + File sender + File sender + + + + ERROR + ERROR + + + + You have not selected any files + You have not selected any files + + + + Cancel send + Cancel send + + + + The current file transfer will be cancelled if it is not completed and all connections will be disconnected. +Are you sure you want to cancel sending files? + The current file transfer will be cancelled if it is not completed and all connections will be disconnected. +Are you sure you want to cancel sending files? + diff --git a/App/language_zh_CN.ts b/App/language_zh_CN.ts index 744ffd5..9507b9a 100644 --- a/App/language_zh_CN.ts +++ b/App/language_zh_CN.ts @@ -10,6 +10,7 @@ + Add new chat 新建群聊 @@ -33,6 +34,16 @@ Return 返回 + + + Warning + 警告 + + + + Name can not be empty + 名称不能为空 + ChatBoxWidget @@ -144,6 +155,7 @@ + Send file 发送文件 @@ -199,7 +211,6 @@ - Number of online user: Number of online user: 0 当前在线人数: @@ -239,6 +250,91 @@ IP IP 地址 + + Chat %1 on port %2 + [Chat] %1 on port %2 + 群聊 %1 在端口 %2 + + + + Clean all message + 清空聊天框 + + + + Are you sure you want to clear all messages? + 您确定要清空聊天框吗? + + + + + + Warning + 警告 + + + + Can not save! +Message box is empty + 无法保存! +信息框为空 + + + + Save file + 保存文件 + + + + Save cancel + 取消保存 + + + + Cancel sending file + 取消文件发送 + + + + Error + 错误 + + + + File size cannot exceed 1Gb + 文件大小不能超过 1GB + + + + File reception request + 文件接收请求 + + + + [%1] from group [%2] wants to send you a file, do you want to receive it? + +--------------------- +File information: +Name: %3 +Size: %4Kb + 来自 [%2] 的 [%1] 希望向您发送一个文件,您想接收吗? + +--------------------- +文件信息: +文件名: %3 +大小: %4Kb + + + + %1 online + %1 online! + %1 上线 + + + + %1 left on %2 + %1 在 %2 退出 + ChatList @@ -302,6 +398,21 @@ XXXX/XXXXXX + + + PolyChat Chat list + PolyChat 群聊列表 + + + + Warning + 警告 + + + + Chat with the same name already exists + 已存在同名群聊 + LoginWidget @@ -340,6 +451,16 @@ Return 返回 + + + PolyChat Login + 登录 PolyChat + + + + Name or Group number can not be empty + 名称或班级号不能为空 + TcpClient @@ -441,6 +562,46 @@ Receipter Return + + + File receipter + 文件接收器 + + + + Save file to + 文件保存至 + + + + ERROR + 错误 + + + + File path is empty, you did not specify a save directory. +You can click on the `Save` button to receive the file again + 文件路径为空,您没有指定保存目录 +您可以点击 "保存 "按钮再次接收文件 + + + File path is empty, because the file save path is empty (You did not specify a save directory). +You can click on the `Save` button to receive the file again + 文件路径为空,您没有指定保存目录 +您可以点击 "保存 "按钮再次接收文件 + + + + Cancel receive + 取消接收 + + + + If the file is not received, it will be stopped and disconnected. +Are you sure you want to cancel receiving files? + 如果没有接收完文件,此操作会停止并断开连接 +您确定要取消接收文件吗? + TcpServer @@ -520,5 +681,32 @@ Receipter Esc + + + File sender + 文件发送器 + + + + ERROR + 错误 + + + + You have not selected any files + 您没有选择任何文件 + + + + Cancel send + 取消发送 + + + + The current file transfer will be cancelled if it is not completed and all connections will be disconnected. +Are you sure you want to cancel sending files? + 如果当前文件传输未完成,则将取消传输,并断开所有连接 +您确定要取消发送文件吗? + diff --git a/App/main.cpp b/App/main.cpp index 5db51f4..f90f062 100644 --- a/App/main.cpp +++ b/App/main.cpp @@ -1,4 +1,5 @@ #include +#include #include "uil_chatboxwidget.h" #include "uil_loginwidget.h" @@ -15,7 +16,10 @@ ChatList* chatList = nullptr; // Widget ChatList (Onl int main(int argc, char *argv[]) { QApplication a(argc, argv); - a.setWindowIcon(QIcon(":/icon/icons/logo_fox.png")); + a.setWindowIcon(QIcon(":/icon/icons/logo_fox.png")); + +// QString appDirPath = QCoreApplication::applicationDirPath(); //程序所在路径 +// qDebug() << appDirPath; LoginWidget login; login.show(); diff --git a/App/resource.qrc b/App/resource.qrc index d08dba0..e4ccd92 100644 --- a/App/resource.qrc +++ b/App/resource.qrc @@ -29,4 +29,8 @@ background/bg-login.png + + language_EN.qm + language_zh_CN.qm + diff --git a/App/tcpclient.cpp b/App/tcpclient.cpp index ab7cfb7..2b922f4 100644 --- a/App/tcpclient.cpp +++ b/App/tcpclient.cpp @@ -13,7 +13,7 @@ TcpClient::TcpClient(QWidget *parent, const QString &fileName, qint64 fileSizeBy ui(new Ui::TcpClient) { ui->setupUi(this); - this->setWindowTitle("File receipter"); + this->setWindowTitle(tr("File receipter")); this->setAttribute(Qt::WA_DeleteOnClose); appendTextBrowser(Qt::blue, "[INFO] TCP client start"); @@ -89,12 +89,12 @@ void TcpClient::connectTcpServerAndOpenFile() { /* 获取保存路径 */ ui->lbFileSavePath->setText("[EMPTY] Click `Save` to receive the file"); - QString savePath = QFileDialog::getSaveFileName(this, "Save file to", fileName); + QString savePath = QFileDialog::getSaveFileName(this, tr("Save file to"), fileName); if (savePath.isEmpty()) { appendTextBrowser(Qt::red, "[ERROR] Save cancel, because the file save path is empty. Click on the `Save` button to receive the file again"); - QMessageBox::critical(this, "ERROR", "File path is empty, because the file save path is empty (You did not specify a save directory).\n" - "You can click on the `Save` button to receive the file again"); + QMessageBox::critical(this, tr("ERROR"), tr("File path is empty, you did not specify a save directory.\n" + "You can click on the `Save` button to receive the file again")); return; } @@ -183,11 +183,12 @@ void TcpClient::receiveTcpDataAndSave() void TcpClient::closeEvent(QCloseEvent* event) { - QMessageBox::StandardButton btnPush = QMessageBox::warning(this, "Cancel receive", - "If the file is not received, it will be stopped and disconnected.\n" - "Are you sure you want to cancel receiving files?", - QMessageBox::No | QMessageBox::Yes, - QMessageBox::No); + QMessageBox::StandardButton btnPush = + QMessageBox::warning(this, tr("Cancel receive"), + tr("If the file is not received, it will be stopped and disconnected.\n" + "Are you sure you want to cancel receiving files?"), + QMessageBox::No | QMessageBox::Yes, + QMessageBox::No); if (btnPush == QMessageBox::No) { event->ignore(); @@ -196,8 +197,9 @@ void TcpClient::closeEvent(QCloseEvent* event) { tcpSocket->disconnectFromHost(); //断开连接 tcpSocket->close(); //关闭套接字 + event->accept(); - QWidget::closeEvent(event); + QWidget::closeEvent(event); // 向上传递 } } diff --git a/App/tcpserver.cpp b/App/tcpserver.cpp index 916e4f0..5a81686 100644 --- a/App/tcpserver.cpp +++ b/App/tcpserver.cpp @@ -13,7 +13,7 @@ TcpServer::TcpServer(QWidget *parent, QString filePath, QHostAddress ip, qint16 ui(new Ui::TcpServer) { ui->setupUi(this); - this->setWindowTitle("File sender"); + this->setWindowTitle(tr("File sender")); this->setAttribute(Qt::WA_DeleteOnClose); appendTextBrowser(Qt::blue, "[INFO] TCP server start"); @@ -27,7 +27,7 @@ TcpServer::TcpServer(QWidget *parent, QString filePath, QHostAddress ip, qint16 if (filePath.isEmpty()) { appendTextBrowser(Qt::red, "[ERROR] Send Cancel"); - QMessageBox::critical(this, "ERROR", "File path is empty"); + QMessageBox::critical(this, tr("ERROR"), tr("You have not selected any files")); return; } @@ -187,11 +187,12 @@ void TcpServer::appendTextBrowser(Qt::GlobalColor color, QString text) void TcpServer::closeEvent(QCloseEvent* event) { - QMessageBox::StandardButton btnPush = QMessageBox::warning(this, "Cancel send", - "The current file transfer will be cancelled if it is not completed and all connections will be disconnected.\n" - "Are you sure you want to cancel sending files?", - QMessageBox::No | QMessageBox::Yes, - QMessageBox::No); + QMessageBox::StandardButton btnPush = + QMessageBox::warning(this, tr("Cancel send"), + tr("The current file transfer will be cancelled if it is not completed and all connections will be disconnected.\n" + "Are you sure you want to cancel sending files?"), + QMessageBox::No | QMessageBox::Yes, + QMessageBox::No); if (btnPush == QMessageBox::No) { event->ignore(); diff --git a/App/uil_addchat.cpp b/App/uil_addchat.cpp index f38e04c..c53b8b2 100644 --- a/App/uil_addchat.cpp +++ b/App/uil_addchat.cpp @@ -10,7 +10,7 @@ AddChat::AddChat(QWidget *parent) : ui(new Ui::AddChat) { ui->setupUi(this); - this->setWindowTitle("Add new chat"); + this->setWindowTitle(tr("Add new chat")); this->setWindowIcon(QIcon(":/icon/icons/register-add-friend.png")); this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowModality(Qt::ApplicationModal); @@ -22,7 +22,7 @@ AddChat::AddChat(QWidget *parent) : this, [=](){ if (ui->leNameNewChat->text().isEmpty()) { - QMessageBox::warning(this, "Warning", "Name can not be empty"); + QMessageBox::warning(this, tr("Warning"), tr("Name can not be empty")); return; } diff --git a/App/uil_chatboxwidget.cpp b/App/uil_chatboxwidget.cpp index 4197696..338cb5b 100644 --- a/App/uil_chatboxwidget.cpp +++ b/App/uil_chatboxwidget.cpp @@ -21,9 +21,11 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port) port(port) { ui->setupUi(this); - this->setWindowTitle(QString("[Chat] %1 on port %2").arg(name).arg(port)); this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowIcon(QIcon(":/icon/icons/user-group.png")); + this->setWindowTitle(QString("Chat %1 on port %2").arg(name, port)); +// this->setWindowTitle(tr("Chat %1 on port %2").arg(name, port)); + /* 对所有窗口的同样地址广播 8888 (告诉 ChatList 本窗口存在) */ this->udpSocketOnPortChatList = new QUdpSocket(this); @@ -94,7 +96,7 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port) /* 更改颜色 */ connect(ui->btnColor, &QToolButton::clicked, this, [=](){ - QColor color = QColorDialog::getColor(Qt::black); + QColor color = QColorDialog::getColor(Qt::black); // getColor 参数中颜色是默认开启颜色对话框中的颜色 ui->msgTextEdit->setTextColor(color); }); @@ -104,8 +106,8 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port) if (QMessageBox::Ok == QMessageBox::question(this, - "Clean all message", - "Are you sure you want to clear all messages?", + tr("Clean all message"), + tr("Are you sure you want to clear all messages?"), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel)) { @@ -117,14 +119,14 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port) this, [=](){ if (ui->msgTextBrowser->document()->isEmpty()) { - QMessageBox::warning(this, "Warning", "Can not save!\nMessage box is empty"); + QMessageBox::warning(this, tr("Warning"), tr("Can not save!\nMessage box is empty")); return; } - QString path = QFileDialog::getSaveFileName(this, "Save file", "PolyChat-MsgLog", "(*.txt)"); + QString path = QFileDialog::getSaveFileName(this, tr("Save file"), "PolyChat-MsgLog", "(*.txt)"); if (path.isEmpty()) { - QMessageBox::warning(this, "Warning", "Save cancel"); + QMessageBox::warning(this, tr("Warning"), tr("Save cancel")); return; } @@ -138,18 +140,18 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port) /* 发送文件 */ connect(ui->btnFileSend, &QToolButton::clicked, this, [=](){ - QString path = QFileDialog::getOpenFileName(this, "Send file", "."); + QString path = QFileDialog::getOpenFileName(this, tr("Send file"), "."); if (path.isEmpty()) { - QMessageBox::warning(this, "Warning", "File sending cancellation"); + QMessageBox::warning(this, tr("Warning"), tr("Cancel sending file")); return; } QFileInfo info(path); if (info.size() > FILE_SEND_MAX_BYTES) { - QMessageBox::critical(this, "Error", "File size cannot exceed 1Gb"); + QMessageBox::critical(this, tr("Error"), tr("File size cannot exceed 1Gb")); return; } @@ -217,7 +219,7 @@ void ChatBoxWidget::sendUDPSignal(const SignalType type) break; // END SignalType::ChatExist case SignalType::ChatDestory: - dataStream << QString("SignalType::ChatDestory"); + dataStream << QString("SignalType::ChatDestory"); udpSocketOnPortChatList->writeDatagram(resByteArray, QHostAddress(QHostAddress::Broadcast), DAL::getPortChatList()); @@ -249,14 +251,14 @@ void ChatBoxWidget::sendUDPSignal(const SignalType type) break; // END SignalType::File case SignalType::UserJoin: - dataStream << QString("SignalType::UserJoin"); + dataStream << QString("SignalType::UserJoin"); udpSocketOnPortChatBox->writeDatagram(resByteArray, QHostAddress(QHostAddress::Broadcast), port); break; // END SignalType::UserJoin case UserLeft: - dataStream << QString("SignalType::UserLeft"); + dataStream << QString("SignalType::UserLeft"); udpSocketOnPortChatBox->writeDatagram(resByteArray, QHostAddress(QHostAddress::Broadcast), port); @@ -343,7 +345,7 @@ void ChatBoxWidget::receiveUDPMessage() */ if (localIpAddress_6 == DAL::getLocalIpAddress()) { return; } // 如果文件接收方和发送方都是本机,那么不需要弹出文件接收请求 #endif - if (QMessageBox::Yes == QMessageBox::information(this, "File reception request", QString( + if (QMessageBox::Yes == QMessageBox::information(this, tr("File reception request"), tr( "[%1] from group [%2] wants to send you a file, do you want to receive it?\n\n" "---------------------\n" "File information:\n" @@ -386,7 +388,7 @@ void ChatBoxWidget::userJoin(QString name, QString groupNumber, QHostAddress ip) /* 追加聊天记录 */ ui->msgTextBrowser->setTextColor(Qt::gray); - ui->msgTextBrowser->append(QString("%1 online!").arg(name)); + ui->msgTextBrowser->append(tr("%1 online").arg(name)); /* 在线用户更新 */ ui->lbNumberOnlineUse->setText(QString::number(ui->tbUser->rowCount())); @@ -407,7 +409,7 @@ void ChatBoxWidget::userLeft(QString name, QString time) /* 追加聊天记录 */ ui->msgTextBrowser->setTextColor(Qt::gray); - ui->msgTextBrowser->append(QString("%1 left on %2").arg(name, time)); + ui->msgTextBrowser->append(tr("%1 left on %2").arg(name, time)); /* 在线用户更新 */ ui->lbNumberOnlineUse->setText(QString::number(ui->tbUser->rowCount())); diff --git a/App/uil_chatlist.cpp b/App/uil_chatlist.cpp index bbdcabf..3453bf6 100644 --- a/App/uil_chatlist.cpp +++ b/App/uil_chatlist.cpp @@ -13,7 +13,7 @@ ChatList::ChatList(QWidget* parent, QString localUserName, QString localUserGrou ui(new Ui::ChatList) { ui->setupUi(this); - this->setWindowTitle("PolyChat Chat list"); + this->setWindowTitle(tr("PolyChat Chat list")); this->setWindowIcon(QIcon(":/icon/icons/logo_fox.png")); @@ -41,7 +41,7 @@ ChatList::ChatList(QWidget* parent, QString localUserName, QString localUserGrou if (isChatExist(name)) { - QMessageBox::warning(this, "Warning", "Chat with the same name already exists"); + QMessageBox::warning(this, tr("Warning"), tr("Chat with the same name already exists")); return; } @@ -379,7 +379,7 @@ bool ChatList::isNeedHideBtn(QString textOnBtn) /* 如果文本框中的内容为空,则不需要隐藏 */ if (ui->leSearch->text().isEmpty()) return false; - QString strRegExp("\\S*" + ui->leSearch->text() + "\\S*"); + QString strRegExp("\\S*" + ui->leSearch->text() + "\\S*"); // 正则表达式 QRegularExpression regExp; regExp.setPattern(strRegExp); diff --git a/App/uil_loginwidget.cpp b/App/uil_loginwidget.cpp index bcc73a2..b9b9845 100644 --- a/App/uil_loginwidget.cpp +++ b/App/uil_loginwidget.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include + LoginWidget::LoginWidget(QWidget *parent) : QWidget(parent), @@ -11,7 +14,7 @@ LoginWidget::LoginWidget(QWidget *parent) : { ui->setupUi(this); - this->setWindowTitle("PolyChat Login"); + this->setWindowTitle(tr("PolyChat Login")); this->setWindowIcon(QIcon(":/icon/icons/nekosilverfox.png")); ui->leUserName->setFocus(); // this->setAttribute(Qt::WA_DeleteOnClose); @@ -52,7 +55,7 @@ void LoginWidget::userLogin() bool isSuccInitLocalUser = DAL::initLocalUser(ui->leUserName->text(), ui->leUserGroupNumber->text()); if (!isSuccInitLocalUser) { - QMessageBox::warning(this, "Warning", "Name or Group number can not be empty"); + QMessageBox::warning(this, ("Warning"), tr("Name or Group number can not be empty")); return; } this->close(); diff --git a/Tester/tst_PolyChatTester.cpp b/Tester/tst_PolyChatTester.cpp index efbce94..9023ec9 100644 --- a/Tester/tst_PolyChatTester.cpp +++ b/Tester/tst_PolyChatTester.cpp @@ -946,7 +946,7 @@ void PolyChatTester::ut_tcpserver_textBrowser() void PolyChatTester::ut_chatbox_title() { ChatBoxWidget chatBox(nullptr, "3530409/90102", 2333); - QCOMPARE(chatBox.windowTitle(), QString("[Chat] %1 on port %2").arg("3530409/90102").arg(2333)); + QCOMPARE(chatBox.windowTitle(), QString("Chat %1 on port %2").arg("3530409/90102", 2333)); } /** 保证 btnBold 是可选按钮(Checkable-QToolButton),且文字显示被禁用 @@ -1495,7 +1495,7 @@ void PolyChatTester::mt_chatbox_userjoin_msgTextBrowser() chatBox.userJoin("Fox", "5140904/30202", DAL::getLocalIpAddress()); QVERIFY(initString != msgTextBrowser->toPlainText()); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); } /** 用户离开(用户列表正确刷新) @@ -1593,7 +1593,7 @@ void PolyChatTester::mt_chatbox_userleft_msgTextBrowser() chatBox.userJoin("Fox", "5140904/30202", DAL::getLocalIpAddress()); QVERIFY(curString != msgTextBrowser->toPlainText()); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); QString time = QDateTime::currentDateTime().toString("dd-MM-yyyy hh:mm:ss"); curString = msgTextBrowser->toPlainText(); @@ -2241,7 +2241,7 @@ void PolyChatTester::e2e_send_message() QTest::keyClicks(textEdit, "HelloThere"); QCOMPARE(textEdit->toPlainText(), "HelloThere"); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); QPushButton* button = chatBox.findChild("btnSend"); QTest::mouseClick(button, Qt::LeftButton); @@ -2312,7 +2312,7 @@ void PolyChatTester::e2e_send_special_message() QToolButton* btnUnderLine = chatBox.findChild("btnUnderLine"); QTest::mouseClick(btnUnderLine, Qt::LeftButton); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); QPushButton* button = chatBox.findChild("btnSend"); QTest::mouseClick(button, Qt::LeftButton); @@ -2506,7 +2506,7 @@ void PolyChatTester::e2e_clean_chat() QCOMPARE(label->text(), QString::number(table->rowCount())); QVERIFY(initString != msgTextBrowser->toPlainText()); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); timer->start(TIMER_STEP); QToolButton* btnClean = chatBox.findChild("btnClean"); @@ -2565,7 +2565,7 @@ void PolyChatTester::e2e_save_chat() QCOMPARE(label->text(), QString::number(table->rowCount())); QVERIFY(initString != msgTextBrowser->toPlainText()); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); timer->start(TIMER_STEP); QToolButton* btnSave = chatBox.findChild("btnSave"); @@ -2628,7 +2628,7 @@ void PolyChatTester::e2e_leave_chat() QTest::keyClicks(textEdit, "HelloThere"); QCOMPARE(textEdit->toPlainText(), "HelloThere"); - QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online!").arg("Fox")); + QCOMPARE(msgTextBrowser->toPlainText(), QString("%1 online").arg("Fox")); QPushButton* button = chatBox.findChild("btnSend"); QTest::mouseClick(button, Qt::LeftButton); From 43a329af34439da4e850e1e9ca6b756880176a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E7=B3=96=E9=9B=AA=E7=8B=B8?= Date: Sat, 6 Apr 2024 20:21:02 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20ignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1ae9d03..3628172 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,6 @@ ui_*.h *.jsc Makefile* *build-* -# *.qm *.prl # Qt unit tests From c9a6eae83e5b50bf3cdd24fe8fcf9b4093e4c053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E7=B3=96=E9=9B=AA=E7=8B=B8?= Date: Sat, 6 Apr 2024 20:22:12 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E4=BA=8C=E8=BF=9B?= =?UTF-8?q?=E5=88=B6=E7=BF=BB=E8=AF=91=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/language_EN.qm | Bin 0 -> 10341 bytes App/language_zh_CN.qm | Bin 0 -> 8296 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 App/language_EN.qm create mode 100644 App/language_zh_CN.qm diff --git a/App/language_EN.qm b/App/language_EN.qm new file mode 100644 index 0000000000000000000000000000000000000000..f9adf490083203edfa404073a46456413e3eadf9 GIT binary patch literal 10341 zcmcIpYiu0V6+X6i{aCM^U>uVgCz(7PCB(R~2_bc%c{q0B#BnU!Ar2uT>)ly<%6i9{ zosDf!5eh2e5h#L&5FVua zt!iuc&d!{B?z!il$9K-0`_shS7v8`9&`S%Op5A-cQ*Rz6qOh92Xvg3NqR?#oT0t~x z65~pu(gBQX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