From bf76835779ae73f870a7e047803e005ad9b61018 Mon Sep 17 00:00:00 2001 From: "huheng@kylinos.cn" Date: Thu, 15 Jun 2023 16:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E8=BF=9E=E6=8E=A5=E6=A8=A1?= =?UTF-8?q?=E5=9D=97):=20=E6=B7=BB=E5=8A=A0=E5=A4=9A=E6=AC=A1=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=A4=84=E7=90=86=EF=BC=8C=E9=98=B2=E6=AD=A2=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connectmanage/connectionservice.cpp | 42 +++--- connectmanage/connectionservice.h | 116 +++++++-------- translations/kylin-connectivity_bo_CN.ts | 176 +++++++++++----------- translations/kylin-connectivity_en.ts | 180 ++++++++++++----------- translations/kylin-connectivity_zh_CN.ts | 180 ++++++++++++----------- ui/mainwindow.cpp | 30 ++-- 6 files changed, 379 insertions(+), 345 deletions(-) diff --git a/connectmanage/connectionservice.cpp b/connectmanage/connectionservice.cpp index de06c4f..ed9fc7b 100644 --- a/connectmanage/connectionservice.cpp +++ b/connectmanage/connectionservice.cpp @@ -49,31 +49,33 @@ ConnectionService::~ConnectionService() } } -void ConnectionService::startClient(const QString host) +bool ConnectionService::startClient(const QString host) { + if (m_messageTcpSocket != nullptr) { + qInfo() << "There is currently a connection in progress!"; + return false; + } m_isClient = true; m_serverIp = host; m_connectInfo.connectType = ConnectType::WIFI; - if (m_messageTcpSocket == nullptr) { - m_messageTcpSocket = new QTcpSocket; - connect(m_messageTcpSocket, &QTcpSocket::readyRead, this, &ConnectionService::onMessageReadyRead); - connect(m_messageTcpSocket, &QTcpSocket::connected, this, [=]() { - m_isMsgSocketConnect = true; - // 客户端启动心跳服务监听 - if (m_heartTcpServer == nullptr) { - m_heartTcpServer = new QTcpServer; - connect(m_heartTcpServer, &QTcpServer::newConnection, this, - &ConnectionService::slotHeartbeatConnection); - } - int sendRe = m_heartTcpServer->listen(QHostAddress::Any, HEARTBEAT_PORT); - if (sendRe == -1) { - qInfo() << "Tcpserver listening port " + QString::number(HEARTBEAT_PORT) + " failed!"; - } else { - qInfo() << "Tcpserver listening port " + QString::number(HEARTBEAT_PORT) + " succeeded!"; - } - }); - } + m_messageTcpSocket = new QTcpSocket; + connect(m_messageTcpSocket, &QTcpSocket::readyRead, this, &ConnectionService::onMessageReadyRead); + connect(m_messageTcpSocket, &QTcpSocket::connected, this, [=]() { + m_isMsgSocketConnect = true; + // 客户端启动心跳服务监听 + if (m_heartTcpServer == nullptr) { + m_heartTcpServer = new QTcpServer; + connect(m_heartTcpServer, &QTcpServer::newConnection, this, &ConnectionService::slotHeartbeatConnection); + } + int sendRe = m_heartTcpServer->listen(QHostAddress::Any, HEARTBEAT_PORT); + if (sendRe == -1) { + qInfo() << "Tcpserver listening port " + QString::number(HEARTBEAT_PORT) + " failed!"; + } else { + qInfo() << "Tcpserver listening port " + QString::number(HEARTBEAT_PORT) + " succeeded!"; + } + }); m_messageTcpSocket->connectToHost(host, LISTEN_PORT); + return true; } void ConnectionService::setConnectionCallback(ConnectSuccessCallBack connectSuccessCallBack, diff --git a/connectmanage/connectionservice.h b/connectmanage/connectionservice.h index 9dc48e1..393158b 100644 --- a/connectmanage/connectionservice.h +++ b/connectmanage/connectionservice.h @@ -13,8 +13,8 @@ #include "messageserialize.pb.h" #include "adbprocess.h" -typedef std::function ConnectSuccessCallBack; // 定义连接成功函数类型 -typedef std::function ConnectFailCallBack; // 定义连接失败函数类型 +typedef std::function ConnectSuccessCallBack; // 定义连接成功函数类型 +typedef std::function ConnectFailCallBack; // 定义连接失败函数类型 class ConnectionService : public QObject { @@ -25,7 +25,7 @@ public: // wifi连接 // 启动客户端连接服务器 - void startClient(const QString host); + bool startClient(const QString host); // 设置连接是否成功回调函数 void setConnectionCallback(ConnectSuccessCallBack connectSuccessCallBack, ConnectFailCallBack connectFailCallBack); // 尝试连接address:port主机地址,使用前需设置成功和失败的回调函数 @@ -58,30 +58,28 @@ public: public: enum ConnectType { - NOTCONNECT = 0, // 未连接 - WIFI, // WiFi连接 - USB // USB连接 + NOTCONNECT = 0, // 未连接 + WIFI, // WiFi连接 + USB // USB连接 }; Q_ENUM(ConnectType) enum DeviceType { - PC = 0, // PC端 - ANDROID, // 安卓端 - UNKNOWN // 未知设备 + PC = 0, // PC端 + ANDROID, // 安卓端 + UNKNOWN // 未知设备 }; Q_ENUM(DeviceType) enum DeviceRole { - INITIATOR = 0, // 发起者 - RECIPIENT, // 接收者 + INITIATOR = 0, // 发起者 + RECIPIENT, // 接收者 }; Q_ENUM(DeviceRole) - struct FtpNamePwd - { - QString username = ""; // 用户名 - QString pwd = ""; // 密码 + struct FtpNamePwd { + QString username = ""; // 用户名 + QString pwd = ""; // 密码 }; - struct ConnectionInfo - { + struct ConnectionInfo { QString uuid = 0; QString deviceName = ""; QString address = ""; @@ -115,17 +113,17 @@ public Q_SLOTS: private: enum DataType { - FILE_DATA = 0, // 文件内容 - STREAM_DATA, // 流数据 - BYTE_DATA, // 字节数据 - FREE // 空闲 + FILE_DATA = 0, // 文件内容 + STREAM_DATA, // 流数据 + BYTE_DATA, // 字节数据 + FREE // 空闲 }; enum AndroidConnType { - ADB = 0, // 有线adb - CONNECTWIFI = 1, // wifi - WIFIADB = 2, // 无线adb - NOTANDROID = 3 // 不是安卓设备 + ADB = 0, // 有线adb + CONNECTWIFI = 1, // wifi + WIFIADB = 2, // 无线adb + NOTANDROID = 3 // 不是安卓设备 }; private: @@ -154,42 +152,42 @@ private: private: // wifi - QTcpServer *m_tcpServer = nullptr; // Tcp服务 - QTcpSocket *m_messageTcpSocket = nullptr; // 消息通道 - QTcpSocket *m_dataTcpSocket = nullptr; // 数据通道 - QTcpServer *m_heartTcpServer = nullptr; // 心跳机制服务 - QTcpSocket *m_heartbeatSocket = nullptr; //心跳通道 - ServerStatus *m_serverStatus = nullptr; // 判断服务器状态 - QThread *m_statusThread = nullptr; // 判断服务器状态线程 - ConnectSuccessCallBack m_connectSuccessCallBack = nullptr; // 连接成功回调函数 - ConnectFailCallBack m_connectFailCallBack = nullptr; // 连接失败回调函数 + QTcpServer *m_tcpServer = nullptr; // Tcp服务 + QTcpSocket *m_messageTcpSocket = nullptr; // 消息通道 + QTcpSocket *m_dataTcpSocket = nullptr; // 数据通道 + QTcpServer *m_heartTcpServer = nullptr; // 心跳机制服务 + QTcpSocket *m_heartbeatSocket = nullptr; // 心跳通道 + ServerStatus *m_serverStatus = nullptr; // 判断服务器状态 + QThread *m_statusThread = nullptr; // 判断服务器状态线程 + ConnectSuccessCallBack m_connectSuccessCallBack = nullptr; // 连接成功回调函数 + ConnectFailCallBack m_connectFailCallBack = nullptr; // 连接失败回调函数 QFile *m_writeFile = nullptr; // usb - AdbProcess *m_adb = nullptr; // adb接口 - QTimer *m_timer = nullptr; //获取socket状态定时器 + AdbProcess *m_adb = nullptr; // adb接口 + QTimer *m_timer = nullptr; // 获取socket状态定时器 - ConnectionInfo m_connectInfo; // 连接信息 - QString m_serverIp = ""; // 服务器主机地址 - int m_port = 0; // 服务器端口 - QStringList m_filePathList; // 所有文件路径 - ProtobufFilesInfo m_filesInfo; // 所有文件信息 - bool m_isMsgSocketConnect = false; // 消息通道是否已连接 - DataType m_dataType = DataType::FREE; // 当前数据类型 - qint64 m_dataSize = 0; // 接收的数据大小 - qint64 m_writeSize = 0; // 当前写入文件大小 - bool m_isHead = true; // 是否为数据头部 - int m_currentFileIndex = 0; // 当前文件索引 - QByteArray m_data; // 需要发送的数据 - QString m_fileSavePath = ""; // 文件保存路径 - QStringList m_deviceSerialList; // 设备序列号列表 - bool m_isSupportADB = false; // 安卓设备是否支持adb反控 - QString m_userName = ""; // ftp用户名 - QString m_password = ""; // ftp密码 - AndroidConnType m_androidConnType = AndroidConnType::NOTANDROID; // 安卓连接类型 - bool m_isClient = false; // 是否为客户端 - bool m_isSurvival = false; // 是否收到心跳 - bool m_isAgainSendHeartbeat = true; // 是否重新发送 - bool m_isRemoteDisconnect = false; // 是否为远程主机断开 + ConnectionInfo m_connectInfo; // 连接信息 + QString m_serverIp = ""; // 服务器主机地址 + int m_port = 0; // 服务器端口 + QStringList m_filePathList; // 所有文件路径 + ProtobufFilesInfo m_filesInfo; // 所有文件信息 + bool m_isMsgSocketConnect = false; // 消息通道是否已连接 + DataType m_dataType = DataType::FREE; // 当前数据类型 + qint64 m_dataSize = 0; // 接收的数据大小 + qint64 m_writeSize = 0; // 当前写入文件大小 + bool m_isHead = true; // 是否为数据头部 + int m_currentFileIndex = 0; // 当前文件索引 + QByteArray m_data; // 需要发送的数据 + QString m_fileSavePath = ""; // 文件保存路径 + QStringList m_deviceSerialList; // 设备序列号列表 + bool m_isSupportADB = false; // 安卓设备是否支持adb反控 + QString m_userName = ""; // ftp用户名 + QString m_password = ""; // ftp密码 + AndroidConnType m_androidConnType = AndroidConnType::NOTANDROID; // 安卓连接类型 + bool m_isClient = false; // 是否为客户端 + bool m_isSurvival = false; // 是否收到心跳 + bool m_isAgainSendHeartbeat = true; // 是否重新发送 + bool m_isRemoteDisconnect = false; // 是否为远程主机断开 }; -#endif // CONNECTIONSERVICE_H +#endif // CONNECTIONSERVICE_H diff --git a/translations/kylin-connectivity_bo_CN.ts b/translations/kylin-connectivity_bo_CN.ts index ac1a0e7..cb3aa1d 100644 --- a/translations/kylin-connectivity_bo_CN.ts +++ b/translations/kylin-connectivity_bo_CN.ts @@ -137,107 +137,107 @@ FileManageWin - + Go Back མདུན་དུ་སྐྱོད་པ་ - + Go Forward ཕྱིར་བཤོལ་ - - + + Search File བཤེར་འཚོལ་ཡིག་ཆ། - + Select རྩོམ་སྒྲིག - - + + List Mode རེའུ་མིག་རྣམ་པ་ - + Refresh གསར་འདོན་ - - + + Select File ཡིག་ཆ་འདེམས་པ་ - - - - - + + + + + Select All ཡོངས་འདེམས་ - + Finish གྲུབ་པ་ - - - - + + + + Deselect All ཡོངས་འདེམས་མེད་པར་བཟོས། - + Icon Mode རིས་རྟགས་རྣམ་པ་ - + List of Mobile Files ལག་ཐོགས་ཁ་པར་གྱི་ཡིག་ཆའི་རེའུ་མིག - + Picture པར་རིས། - + Video བརྙན་ལམ་ - + Music རོལ་དབྱངས། - + Doc ཡིག་ཆ། - + QQ QQ - + WeChat སྐད་འཕྲིན་ - + Mobile Storage ཁ་པར་གསོག་འཇོག @@ -307,44 +307,45 @@ MainWindow - - + + kylin-connectivity སྣེ་མང་མཐུན་སྦྱོར་ - + Agreed to connect མོས་མཐུན་འབྲེལ་མཐུད། - + Peer has agreed ལས་རིགས་གཅིག་པའི་མོས་མཐུན་བྱས་། - + Establishing connection, please wait... ད་ལྟ་འབྲེལ་མཐུད་འཛུགས་བཞིན་ཡོད།ཏོག་ཙམ་སྒུག་རོགས།... - + CANCEL མེད་པར་བཟོ་བ་ - - - - - - - - - - - + + + + + + + + + + + + OK ཡ་ཡ། @@ -355,7 +356,7 @@ - + file download failed ཡིག་ཆ་ཕབ་ལེན་ཕམ་སོང་། @@ -366,7 +367,7 @@ - + " " @@ -377,29 +378,29 @@ - + NO མེད། - + YES རེད། - + The other party has refused your screen projection request! ཕ་རོལ་བོས་ཁྱོད་ཀྱི་བརྙན་ཡོལ་བརྙན་ཕབ་ཀྱི་རེ་བ་དང་ལེན་མ་བྱས།! - + Failed to cast the screen. Please contact the other party and try again. འཆར་ཤེལ་ལ་ཕོག་མི་ཐུབ། རོགས་།ཕ་རོལ་བར་འབྲེལ་གཏུག་དང་།དེ་ནས་ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག་རེད་། - + RECONNECT བསྐྱར་སྦྲེལ། @@ -415,29 +416,29 @@ - - - + + + CLOSE སྒོ་རྒྱག་པ་ - + Please install kylin-assistant on the Android terminal! ཨན་ཀྲོའི་མཐའ་སྣེ་ཐོག་ཆི་ལིན་ལས་རོགས་སྒྲིག་རོགས།! - + Please use the USB to connect your phone device! USBཁྱེད་རང་གི་ཁ་པར་སྒྲིག་ཆས་བེད་སྤྱོད་གཏོང་རོགས། - + Connection error འབྲེལ་མཐུད་ནོར་འཁྲུལ། - + Connection timed out འབྲེལ་མཐུད་དུས་བརྒལ། @@ -450,22 +451,22 @@ བཤིག་འདོན་ཕམ་པ། - + Version: པར་གཞི།: - + Mobile Assistant is an interconnection tool of Android device and Kirin operating system, which supports Android file synchronization, file transfer, screen mirroring and other functions, which is simple and fast to operate སྣེ་མང་མཐུན་སྦྱོར་ནི་ཆི་ལིན་བཀོལ་སྤྱོད་མ་ལག་དབར་གྱི་ཕན་ཚུན་འབྲེལ་མཐུད་ཀྱི་དྲ་སྦྲེལ་ཡོ་བྱད་ཅིག་ཡིན་པ་དང་ཆབས་ཅིག་Andridཡིག་ཆ་དུས་མཉམ་དང་།ཡིག་ཆ་བརྒྱུད་འདྲེན།བརྙན་ཡོལ་སྣང་བརྙན་སོགས་ཀྱི་ནུས་པར་རྒྱབ་སྐྱོར་བྱས་ནས་སྟབས་བདེ་ལ་མྱུར་པོ་ཡོད་པ་རེད། - + Received screen projection request from " བསྡུ་ལེན་ནས་ཡོང་བའི་བརྙན་ཡོལ་བརྙན་ཕབ་རེ་ཞུ་། " - + After consent, the other party can share the device desktop to this screen. འཐད་པ་བྱུང་རྗེས།ཕྱོགས་ཅིག་ཤོས་ཀྱིས་སྒྲིག་ཆས་ཀྱི་ཅོག་ངོས་བརྙན་ཡོལ་འདི་མཉམ་སྤྱོད་བྱས་ཆོག @@ -478,88 +479,93 @@ སྒོ་རྒྱག་པ་ - + The other party agreed to your screen projection request! ཕ་རོལ་བོས་ཁྱོད་ཀྱི་བརྙན་ཡོལ་བརྙན་ཕབ་ཀྱི་རེ་བ་ལ་འཐད།! - + The screen is being cast, please wait... བརྙན་ཡོལ་ཕོག་བཞིན་འདུགཅུང་ཙམ་སྒུག... - - + + End of screen projection བརྙན་ཡོལ་བརྙན་ཕབ་མཇུག་རྫོགས་ - - + + The other party has finished the screen projection function. ཕ་རོལ་བས་འཆར་ཤེལ་བརྙན་ཕབ་ཀྱི་ནུས་པ་འགྲུབ་ཡོད། - - + + Screen projection loading error བརྙན་ཡོལ་བརྙན་ཕབ་ཁུར་སྣོན་ཧེ་བག་ - - + + Please check whether to install the projection expansion package [kylin connectivity tools] ཞིབ་བཤེར་བྱེད་མིན་།སྒྲིག་སྦྱོར་བརྙན་ཕབ་རྒྱ་སྐྱེད་ཁུག་མ་[kylin-connectttity-tools] + - Transmission interruption བརྒྱུད་གཏོང་བར་བཅད། - + The other party's device has insufficient local storage! ཕ་རོལ་སྒྲིག་ཆས་གསོག་འཇོག་བར་སྟོང་མི་འདང་བ་།! - + Insufficient local storage space! རང་སའི་གསོག་འཇོག་བར་སྟོང་མི་འདང་།! - + Uploaded to ཡར་འཕངས། - + + There is currently a connection in progress! + + + + Downloaded to Uploaded to - + File open exception! ཡིག་ཆ་ཁ་འབྱེད་རྒྱུན་འགལ། - + Search data loading failed! བཤེར་འཚོལ་གཞི་གྲངས་ནང་འཇུག་ཕམ་སོང་། - - + + Request sent successfully! སྐུར་ཐུབ་པར་ཞུ།! - + The connection request has been sent to the selected device. Please click [YES] in the opposite pop-up window འབྲེལ་མཐུད་རེ་བར་བདམས་པའི་སྒྲིག་ཆས་ལ་སྐུར་རོགས། ཁ་སྤྲོད་ཀྱི་སྒེའུ་ཁུང་ནང་ནས་གནོན་རོགས། - + The screen projection request has been sent to the connected device. Please click [Agree] in the opposite pop-up window བརྙན་ཡོལ་བརྙན་ཕབ་ཀྱི་རེ་བ་དེ་སྦྲེལ་མཐུད་ཀྱི་སྒྲིག་ཆས་ལ་བསྐུར། མདུན་གྱི་སྒེའུ་ཁུང་ནང་གི་“མོས་མཐུན་ལ་གནོན་། diff --git a/translations/kylin-connectivity_en.ts b/translations/kylin-connectivity_en.ts index 179cffb..41e62dc 100644 --- a/translations/kylin-connectivity_en.ts +++ b/translations/kylin-connectivity_en.ts @@ -167,107 +167,107 @@ FileManageWin - + Go Back Go Back - + Go Forward Go Forward - - + + Search File Search File - + Select Select - - + + List Mode List Mode - + Refresh Refresh - - + + Select File Select File - - - - - + + + + + Select All Select All - + Finish Finish - - - - + + + + Deselect All Deselect All - + Icon Mode Icon Mode - + List of Mobile Files List of Mobile Files - + Picture Picture - + Video Video - + Music Music - + Doc - + QQ QQ - + WeChat WeChat - + Mobile Storage Mobile Storage @@ -337,28 +337,28 @@ MainWindow - - + + kylin-connectivity kylin-connectivity - + Agreed to connect Agreed to connect - + Peer has agreed Peer has agreed - + Establishing connection, please wait... Establishing connection, please wait... - + CANCEL Cancel @@ -377,7 +377,7 @@ - + file download failed file download failed @@ -388,7 +388,7 @@ - + " " @@ -399,34 +399,34 @@ - + NO No - + YES Yes - + File open exception! File open exception! - + The other party has refused your screen projection request! The other party has refused your screen projection request! - + Failed to cast the screen. Please contact the other party and try again. Failed to cast the screen. Please contact the other party and try again. - + RECONNECT Reconnect @@ -442,32 +442,37 @@ - - - + + + CLOSE Close - + Please install kylin-assistant on the Android terminal! Please install kylin-assistant on the Android terminal! - + Please use the USB to connect your phone device! Please use the USB to connect your phone device! - + Connection error Connection error - + Connection timed out Connection timed out + + + There is currently a connection in progress! + + Warning Warning @@ -481,22 +486,22 @@ Umount failed - + Version: Version: - + Mobile Assistant is an interconnection tool of Android device and Kirin operating system, which supports Android file synchronization, file transfer, screen mirroring and other functions, which is simple and fast to operate Mobile Assistant is an interconnection tool of Android device and Kirin operating system, which supports Android file synchronization, file transfer, screen mirroring and other functions, which is simple and fast to operate - + Received screen projection request from " Received screen projection request from " - + After consent, the other party can share the device desktop to this screen. After consent, the other party can share the device desktop to this screen. @@ -509,78 +514,83 @@ Close - + The other party agreed to your screen projection request! The other party agreed to your screen projection request! - + The screen is being cast, please wait... The screen is being cast, please wait... - - + + End of screen projection End of screen projection - - + + The other party has finished the screen projection function. The other party has finished the screen projection function. - + Search data loading failed! Search data loading failed! + - Transmission interruption Transmission interruption - + The other party's device has insufficient local storage! The other party's device has insufficient local storage! - + Insufficient local storage space! Insufficient local storage space! - + There is currently a connection in progress + There is currently a connection in progress + + + The screen projection request has been sent to the connected device. Please click [Agree] in the opposite pop-up window The screen projection request has been sent to the connected device. Please click [Agree] in the opposite pop-up window - - - - - - - - - - - + + + + + + + + + + + + OK Ok - - + + Screen projection loading error Screen projection loading error - - + + Please check whether to install the projection expansion package [kylin connectivity tools] Please check whether to install the projection expansion package [kylin connectivity tools] @@ -641,23 +651,23 @@ QQ - + Uploaded to Uploaded to - + Downloaded to Downloaded to - - + + Request sent successfully! Request sent successfully! - + The connection request has been sent to the selected device. Please click [YES] in the opposite pop-up window The connection request has been sent to the selected device. Please click [YES] in the opposite pop-up window diff --git a/translations/kylin-connectivity_zh_CN.ts b/translations/kylin-connectivity_zh_CN.ts index 36f6f92..39e2b96 100644 --- a/translations/kylin-connectivity_zh_CN.ts +++ b/translations/kylin-connectivity_zh_CN.ts @@ -148,107 +148,107 @@ FileManageWin - + Go Back 后退 - + Go Forward 前进 - - + + Search File 搜索文件 - + Select 编辑 - - + + List Mode 列表模式 - + Refresh 刷新 - - + + Select File 选择文件 - - - - - + + + + + Select All 全选 - + Finish 完成 - - - - + + + + Deselect All 取消全选 - + Icon Mode 图标模式 - + List of Mobile Files 手机文件列表 - + Picture 图片 - + Video 视频 - + Music 音乐 - + Doc 文档 - + QQ QQ - + WeChat 微信 - + Mobile Storage 手机存储 @@ -318,28 +318,28 @@ MainWindow - - + + kylin-connectivity 多端协同 - + Agreed to connect 同意连接 - + Peer has agreed 对方已同意 - + Establishing connection, please wait... 正在建立连接,请稍候 - + CANCEL 取消 @@ -358,7 +358,7 @@ - + file download failed 文件下载失败 @@ -369,7 +369,7 @@ - + " " 的请求 @@ -380,34 +380,34 @@ - + NO 拒绝 - + YES 同意 - + File open exception! 文件打开异常! - + The other party has refused your screen projection request! 对方拒绝了你的投屏请求! - + Failed to cast the screen. Please contact the other party and try again. 投屏失败,请联系对方后重新尝试。 - + RECONNECT 重新连接 @@ -423,32 +423,37 @@ - - - + + + CLOSE 关闭 - + Please install kylin-assistant on the Android terminal! 请在手机端下载麒麟手机助手app! - + Please use the USB to connect your phone device! 请使用USB连接手机设备 - + Connection error 连接失败 - + Connection timed out 连接超时 + + + There is currently a connection in progress! + 当前有连接正在进行! + Warning 警告 @@ -462,22 +467,22 @@ 卸载失败 - + Version: 版本: - + Mobile Assistant is an interconnection tool of Android device and Kirin operating system, which supports Android file synchronization, file transfer, screen mirroring and other functions, which is simple and fast to operate 多端协同是一款麒麟操作系统之间的互通互联工具,同时也支持Android文件同步、文件传输、屏幕镜像等功能,操作简单快捷。 - + Received screen projection request from " 收到来自 " - + After consent, the other party can share the device desktop to this screen. 同意后,对方可将设备桌面共享至本屏幕上。 @@ -490,78 +495,83 @@ 关闭 - + The other party agreed to your screen projection request! 对方同意了您的投屏请求! - + The screen is being cast, please wait... 正在投屏,请稍等... - - + + End of screen projection 投屏结束 - - + + The other party has finished the screen projection function. 对方已结束了投屏功能。 - + Search data loading failed! 搜索数据加载失败! + - Transmission interruption 传输中断 - + The other party's device has insufficient local storage! 对方设备空间不足! - + Insufficient local storage space! 本地设备空间不足! - + There is currently a connection in progress + 当前有连接正在进行! + + + The screen projection request has been sent to the connected device. Please click [Agree] in the opposite pop-up window 已将投屏请求发送至已连接设备,请在对端弹窗中点击【同意】 - - - - - - - - - - - + + + + + + + + + + + + OK 确定 - - + + Screen projection loading error 投屏加载失败 - - + + Please check whether to install the projection expansion package [kylin connectivity tools] 请检查是否安装投屏扩展包[kylin-connectivity-tools] @@ -622,23 +632,23 @@ QQ - + Uploaded to 上传至 - + Downloaded to 下载到 - - + + Request sent successfully! 请求发送成功! - + The connection request has been sent to the selected device. Please click [YES] in the opposite pop-up window 已将连接请求发送至所选设备,请在对端弹窗中点击【同意】 diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 228a33c..2ee48fe 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -1871,17 +1871,25 @@ void MainWindow::slotReturnHomePage() void MainWindow::slotConnectServiceUI(QString address) { - m_reconnectAddress = address; - m_connectionService->startClient(address); - startTimer(); - QString str1 = QString(tr("Request sent successfully!")); - QString str2 = QString(tr("The connection request has been sent to the selected device. Please click [YES] in " - "the opposite pop-up window")); - m_messageBox = new MessageDialog(this); - m_messageBox->setText(str1, str2); - m_messageBox->setIconPixmap(QIcon::fromTheme("ukui-dialog-success")); - m_messageBox->addButton(QString(tr("OK"))); - moveMessageBox(); + bool ret = m_connectionService->startClient(address); + if (ret) { + m_reconnectAddress = address; + startTimer(); + QString str1 = QString(tr("Request sent successfully!")); + QString str2 = QString(tr("The connection request has been sent to the selected device. Please click [YES] in " + "the opposite pop-up window")); + m_messageBox = new MessageDialog(this); + m_messageBox->setText(str1, str2); + m_messageBox->setIconPixmap(QIcon::fromTheme("ukui-dialog-success")); + m_messageBox->addButton(QString(tr("OK"))); + moveMessageBox(); + } else { + m_messageBox = new MessageDialog(this); + m_messageBox->setText(tr("There is currently a connection in progress!")); + m_messageBox->setIconPixmap(QIcon::fromTheme("dialog-warning")); + m_messageBox->addButton(QString(tr("OK"))); + moveMessageBox(); + } } void MainWindow::slotConnectedWinBtnClicked(ConnectedWin::BtnType type)