zhongfuqiang上传最新代码20250325
This commit is contained in:
@@ -230,6 +230,40 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
|
||||
currentItem["val"] = text;
|
||||
}
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "CHANGE_THEME") {
|
||||
QString downloadUrl;
|
||||
QEventLoop loop;
|
||||
emit startImageSharing(CHANGE_THEME_W, CHANGE_THEME_H, "theme", [&downloadUrl, &loop](QString responseUrl) {
|
||||
//qDebug() << "Received response from slot:" << responseUrl;
|
||||
downloadUrl = responseUrl; // 更新局部变量
|
||||
loop.quit(); // 退出事件循环
|
||||
});
|
||||
//loop.exec(); // 等待回调执行完成
|
||||
if (!downloadUrl.isEmpty()) {
|
||||
qDebug() << "Image available at:" << downloadUrl;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
currentItem["val"] = downloadUrl;
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "UPDATE_LOGO") {
|
||||
QString downloadUrl;
|
||||
QEventLoop loop;
|
||||
emit startLOGOImageSharing(CHANGE_THEME_W, CHANGE_THEME_H, "theme", [&downloadUrl, &loop](QString responseUrl) {
|
||||
//qDebug() << "Received response from slot:" << responseUrl;
|
||||
downloadUrl = responseUrl; // 更新局部变量
|
||||
loop.quit(); // 退出事件循环
|
||||
});
|
||||
//loop.exec(); // 等待回调执行完成
|
||||
if (!downloadUrl.isEmpty()) {
|
||||
qDebug() << "Image available at:" << downloadUrl;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
currentItem["val"] = downloadUrl;
|
||||
}
|
||||
else if (!text.isEmpty() && currentItem.contains("UUID") && currentItem.contains("SN")) {
|
||||
QJsonValue originalUUID = currentItem["UUID"];
|
||||
QJsonValue originalSN = currentItem["SN"];
|
||||
@@ -280,6 +314,101 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendBackFuncItem(int itemIndex, const QString text)
|
||||
{
|
||||
if (isBackBoardOrAllBoard == 0) {
|
||||
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//qDebug() << "sendFuncItem Text:" << text;
|
||||
sendJsonItem(backBoardFuncConfig, itemIndex, text, "", "func");
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendFrontItem(int itemIndex)
|
||||
{
|
||||
if (isBackBoardOrAllBoard != 0) {
|
||||
emit HandleInvalidOperate("当前连接的是后板或整机,请勿操作前板页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QString text = "";
|
||||
QJsonObject currentItem = frontBoardTest[itemIndex].toObject();
|
||||
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "IMG_ENROLL") {
|
||||
QString downloadUrl;
|
||||
QEventLoop loop;
|
||||
emit startImageSharing(IMG_ENROLL_W, IMG_ENROLL_H, "enroll", [&downloadUrl, &loop](QString responseUrl) {
|
||||
//qDebug() << "Received response from slot:" << responseUrl;
|
||||
downloadUrl = responseUrl; // 更新局部变量
|
||||
loop.quit(); // 退出事件循环
|
||||
});
|
||||
//loop.exec(); // 等待回调执行完成
|
||||
if (!downloadUrl.isEmpty()) {
|
||||
qDebug() << "Image available at:" << downloadUrl;
|
||||
}
|
||||
text = downloadUrl;
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
|
||||
DelUserWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString userInput = dialog.getUserInput();
|
||||
if (!userInput.isEmpty() && currentItem.contains("val")) {
|
||||
text = userInput;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
|
||||
PasswordEnrollWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
text = dialog.getPassword();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendJsonItem(frontBoardTest, itemIndex, text, "", "test");
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendBackItem(int itemIndex)
|
||||
{
|
||||
if (isBackBoardOrAllBoard == 0) {
|
||||
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QString text = "";
|
||||
QJsonObject currentItem = backBoardTest[itemIndex].toObject();
|
||||
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
|
||||
DelUserWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString userInput = dialog.getUserInput();
|
||||
if (!userInput.isEmpty() && currentItem.contains("val")) {
|
||||
text = userInput;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
|
||||
PasswordEnrollWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
text = dialog.getPassword();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
isRecvVideoData = false;
|
||||
sendJsonItem(backBoardTest, itemIndex, text, "", "test");
|
||||
}
|
||||
}
|
||||
|
||||
// 发送获取设备信息按键
|
||||
void ClientHandler::sendGetDevInfoItem(int itemIndex)
|
||||
{
|
||||
@@ -348,118 +477,6 @@ void ClientHandler::sendFrontFuncItem(int itemIndex, const QString text)
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendBackFuncItem(int itemIndex, const QString text)
|
||||
{
|
||||
if (isBackBoardOrAllBoard == 0) {
|
||||
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//qDebug() << "sendFuncItem Text:" << text;
|
||||
sendJsonItem(backBoardFuncConfig, itemIndex, text, "", "func");
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendFrontItem(int itemIndex)
|
||||
{
|
||||
if (isBackBoardOrAllBoard != 0) {
|
||||
emit HandleInvalidOperate("当前连接的是后板或整机,请勿操作前板页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QString text = "";
|
||||
QJsonObject currentItem = frontBoardTest[itemIndex].toObject();
|
||||
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "IMG_ENROLL") {
|
||||
QString downloadUrl;
|
||||
QEventLoop loop;
|
||||
emit startImageSharing(IMG_ENROLL_W, IMG_ENROLL_H, "enroll", [&downloadUrl, &loop](QString responseUrl) {
|
||||
//qDebug() << "Received response from slot:" << responseUrl;
|
||||
downloadUrl = responseUrl; // 更新局部变量
|
||||
loop.quit(); // 退出事件循环
|
||||
});
|
||||
//loop.exec(); // 等待回调执行完成
|
||||
if (!downloadUrl.isEmpty()) {
|
||||
qDebug() << "Image available at:" << downloadUrl;
|
||||
}
|
||||
text = downloadUrl;
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
|
||||
DelUserWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString userInput = dialog.getUserInput();
|
||||
if (!userInput.isEmpty() && currentItem.contains("val")) {
|
||||
text = userInput;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
|
||||
PasswordEnrollWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
text = dialog.getPassword();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendJsonItem(frontBoardTest, itemIndex, text, "", "test");
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendBackItem(int itemIndex)
|
||||
{
|
||||
if (isBackBoardOrAllBoard == 0) {
|
||||
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QString text = "";
|
||||
QJsonObject currentItem = backBoardTest[itemIndex].toObject();
|
||||
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "CHANGE_THEME") {
|
||||
QString downloadUrl;
|
||||
QEventLoop loop;
|
||||
emit startImageSharing(CHANGE_THEME_W, CHANGE_THEME_H, "theme", [&downloadUrl, &loop](QString responseUrl) {
|
||||
//qDebug() << "Received response from slot:" << responseUrl;
|
||||
downloadUrl = responseUrl; // 更新局部变量
|
||||
loop.quit(); // 退出事件循环
|
||||
});
|
||||
//loop.exec(); // 等待回调执行完成
|
||||
if (!downloadUrl.isEmpty()) {
|
||||
qDebug() << "Image available at:" << downloadUrl;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
text = downloadUrl;
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
|
||||
DelUserWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString userInput = dialog.getUserInput();
|
||||
if (!userInput.isEmpty() && currentItem.contains("val")) {
|
||||
text = userInput;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
|
||||
PasswordEnrollWindow dialog;
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
text = dialog.getPassword();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
isRecvVideoData = false;
|
||||
sendJsonItem(backBoardTest, itemIndex, text, "", "test");
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::sendDevInfoJsonItem(const QJsonObject& jsonItem, int itemIndex)
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
@@ -104,6 +104,7 @@ public:
|
||||
|
||||
signals:
|
||||
void startImageSharing(int width, int height, QString img_type, std::function<void(QString)> callback);
|
||||
void startLOGOImageSharing(int width, int height, QString img_type, std::function<void(QString)> callback);
|
||||
// 数据接收信号
|
||||
void dataReceived(const QString& client, const QByteArray& data, unsigned char msg_id, int currentRecvItemIndex,
|
||||
int currentRecvFuncItemIndex, const QString& itemData, const QString& funcItemData,
|
||||
|
||||
@@ -32,8 +32,13 @@ public:
|
||||
return userInput->text();
|
||||
}
|
||||
|
||||
signals:
|
||||
void userInputEntered(const QString& userInput); // **只发送用户输入,不管取消情况**
|
||||
|
||||
private slots:
|
||||
void onDeleteButtonClicked() {
|
||||
emit userInputEntered(userInput->text()); // **发送输入值**
|
||||
//close(); // **关闭窗口**
|
||||
accept();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user