手机发送特殊字符串,控制电脑端截屏
This commit is contained in:
parent
5cd65b237b
commit
ed78634032
|
@ -123,8 +123,16 @@ void MainWindow::readyRead()
|
|||
type = JO.value("type").toString();
|
||||
if (type == "text") {
|
||||
QString message = JO.value("message").toString();
|
||||
if (message == "Capture") {
|
||||
QScreen *screen = QApplication::primaryScreen();
|
||||
QPixmap pixmap = screen->grabWindow(QApplication::desktop()->winId());
|
||||
QDateTime time = QDateTime::currentDateTime();
|
||||
QString filename = time.toString("yyyyMMddhhmmss") + ".jpg";
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/" + filename;
|
||||
pixmap.save(path, nullptr, 100);
|
||||
}
|
||||
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] [" + IP_remote + "]:" + message);
|
||||
} else if(type == "file") {
|
||||
} else if (type == "file") {
|
||||
fileName = JO.value("fileName").toString();
|
||||
lastModified = JO.value("lastModified").toDouble()/1000;
|
||||
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] [" + IP_remote + "]:" + fileName);
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include <QDropEvent>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QMimeData>
|
||||
#include <QScreen>
|
||||
#include <QDesktopWidget>
|
||||
#include <QStandardPaths>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
|
|
Loading…
Reference in New Issue