打开关键字play改open

This commit is contained in:
sonichy 2022-11-29 16:21:35 +08:00
parent e496932138
commit 89a1d12277
2 changed files with 3 additions and 3 deletions

BIN
FileTrans

Binary file not shown.

View File

@ -135,7 +135,7 @@ void MainWindow::readyRead()
pixmap.save(path, nullptr, 100);
}
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] [" + IP_remote + "] " + command);
} else if (type == "play") {
} else if (type == "open") {
QString surl = JO.value("message").toString();
QDesktopServices::openUrl(QUrl(surl));
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] [" + IP_remote + "] open " + surl);
@ -216,12 +216,12 @@ void MainWindow::on_pushButton_open_pressed()
tcpSocket1->connectToHost(QHostAddress(ui->lineEdit_ip->text()), port);
connect(tcpSocket1, &QTcpSocket::connected, [=](){
QJsonObject JO;
JO.insert("type", "play");
JO.insert("type", "open");
JO.insert("message", s);
QString s = QJsonDocument(JO).toJson(QJsonDocument::Compact);
tcpSocket1->write(s.toUtf8());
tcpSocket1->close();
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] open " + s);
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] 发送 " + s);
});
}