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] =?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);