diff --git a/QtScrcpy/device/ui/toolform.cpp b/QtScrcpy/device/ui/toolform.cpp index 557bda3..ea09914 100644 --- a/QtScrcpy/device/ui/toolform.cpp +++ b/QtScrcpy/device/ui/toolform.cpp @@ -8,6 +8,7 @@ #include "iconhelper.h" #include "videoform.h" #include "controller.h" +#include "adbprocess.h" ToolForm::ToolForm(QWidget* adsorbWidget, AdsorbPositions adsorbPos) : MagneticWidget(adsorbWidget, adsorbPos) @@ -41,6 +42,7 @@ void ToolForm::initStyle() IconHelper::Instance()->SetIcon(ui->powerBtn, QChar(0xf011), 15); IconHelper::Instance()->SetIcon(ui->expandNotifyBtn, QChar(0xf103), 15); IconHelper::Instance()->SetIcon(ui->screenShotBtn, QChar(0xf0c4), 15); + IconHelper::Instance()->SetIcon(ui->touchBtn, QChar(0xf111), 15); } void ToolForm::mousePressEvent(QMouseEvent *event) @@ -150,3 +152,25 @@ void ToolForm::on_expandNotifyBtn_clicked() m_videoForm->getController()->expandNotificationPanel(); } } + +void ToolForm::on_touchBtn_clicked() +{ + if (!m_videoForm) { + return; + } + + m_showTouch = !m_showTouch; + + AdbProcess* adb = new AdbProcess(); + if (!adb) { + return; + } + connect(adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){ + if (AdbProcess::AER_SUCCESS_START != processResult) { + sender()->deleteLater(); + } + }); + adb->setShowTouchesEnabled(m_videoForm->getSerial(), m_showTouch); + + qInfo() << "show touch " << (m_showTouch ? "enable" : "disable"); +} diff --git a/QtScrcpy/device/ui/toolform.h b/QtScrcpy/device/ui/toolform.h index 0f3deca..4b63a35 100644 --- a/QtScrcpy/device/ui/toolform.h +++ b/QtScrcpy/device/ui/toolform.h @@ -53,6 +53,8 @@ private slots: void on_expandNotifyBtn_clicked(); + void on_touchBtn_clicked(); + private: void initStyle(); @@ -60,6 +62,7 @@ private: Ui::ToolForm *ui; QPoint m_dragPosition; QPointer m_videoForm; + bool m_showTouch = false; }; #endif // TOOLFORM_H diff --git a/QtScrcpy/device/ui/toolform.ui b/QtScrcpy/device/ui/toolform.ui index 4676beb..e2bd9fb 100644 --- a/QtScrcpy/device/ui/toolform.ui +++ b/QtScrcpy/device/ui/toolform.ui @@ -53,6 +53,16 @@ + + + + touch switch + + + + + + diff --git a/QtScrcpy/device/ui/videoform.cpp b/QtScrcpy/device/ui/videoform.cpp index ba990b0..fd19a2f 100644 --- a/QtScrcpy/device/ui/videoform.cpp +++ b/QtScrcpy/device/ui/videoform.cpp @@ -247,6 +247,11 @@ void VideoForm::setSerial(const QString &serial) m_serial = serial; } +const QString &VideoForm::getSerial() +{ + return m_serial; +} + void VideoForm::setController(Controller *controller) { m_controller = controller; diff --git a/QtScrcpy/device/ui/videoform.h b/QtScrcpy/device/ui/videoform.h index 0ffa4be..782775d 100644 --- a/QtScrcpy/device/ui/videoform.h +++ b/QtScrcpy/device/ui/videoform.h @@ -28,6 +28,7 @@ public: Controller* getController(); void setFileHandler(FileHandler *fileHandler); void setSerial(const QString &serial); + const QString& getSerial(); signals: void screenshot(); diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.qm b/QtScrcpy/res/i18n/QtScrcpy_en.qm index f73b803..5417e52 100644 Binary files a/QtScrcpy/res/i18n/QtScrcpy_en.qm and b/QtScrcpy/res/i18n/QtScrcpy_en.qm differ diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.ts b/QtScrcpy/res/i18n/QtScrcpy_en.ts index 77a9daa..bec58c4 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_en.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_en.ts @@ -75,7 +75,7 @@ - + select path select path @@ -225,46 +225,51 @@ + touch switch + touch switch + + + close screen close screen - + power power - + volume up volume up - + volume down volume down - + app switch app switch - + menu menu - + home home - + return return - + screen shot screen shot @@ -284,7 +289,7 @@ file transfer failed - + file does not exist file does not exist diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.qm b/QtScrcpy/res/i18n/QtScrcpy_zh.qm index 2a1e884..29e084a 100644 Binary files a/QtScrcpy/res/i18n/QtScrcpy_zh.qm and b/QtScrcpy/res/i18n/QtScrcpy_zh.qm differ diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.ts b/QtScrcpy/res/i18n/QtScrcpy_zh.ts index 7f9721d..710f061 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_zh.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_zh.ts @@ -75,7 +75,7 @@ - + select path 选择路径 @@ -225,46 +225,51 @@ + touch switch + 触摸显示开关 + + + close screen 关闭屏幕 - + power 电源 - + volume up 音量加 - + volume down 音量减 - + app switch 切换应用 - + menu 菜单 - + home 主界面 - + return 返回 - + screen shot 截图 @@ -284,7 +289,7 @@ 文件传输失败 - + file does not exist 文件不存在 diff --git a/docs/TODO.md b/docs/TODO.md index d4de436..978a60e 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -5,7 +5,6 @@ - 中文输入(server需要改为apk,作为一个输入法,暂不实现)(或者有其他方式案件注入方式,例如搜狗手机输入法可以监听当前注入?) - [单独线程统计帧率](https://github.com/Genymobile/scrcpy/commit/e2a272bf99ecf48fcb050177113f903b3fb323c4) - text转换 https://github.com/Genymobile/scrcpy/commit/c916af0984f72a60301d13fa8ef9a85112f54202?tdsourcetag=s_pctim_aiomsg -- ui提供show touch设置 ## 中优先级 - 自动打包脚本