From 9b53e7ce0169b88d4bc930160fac5cf2d597536c Mon Sep 17 00:00:00 2001 From: rankun Date: Fri, 31 Jan 2020 21:14:33 +0800 Subject: [PATCH] feat: add record screen checkbox --- QtScrcpy/device/device.cpp | 2 +- QtScrcpy/dialog.cpp | 32 +++++++++---- QtScrcpy/dialog.h | 2 + QtScrcpy/dialog.ui | 43 +++++++++-------- QtScrcpy/res/i18n/QtScrcpy_en.qm | Bin 3280 -> 3286 bytes QtScrcpy/res/i18n/QtScrcpy_en.ts | 76 ++++++++++++++++--------------- QtScrcpy/res/i18n/QtScrcpy_zh.qm | Bin 2587 -> 2585 bytes QtScrcpy/res/i18n/QtScrcpy_zh.ts | 76 ++++++++++++++++--------------- 8 files changed, 132 insertions(+), 99 deletions(-) diff --git a/QtScrcpy/device/device.cpp b/QtScrcpy/device/device.cpp index 1532438..cebc2f6 100644 --- a/QtScrcpy/device/device.cpp +++ b/QtScrcpy/device/device.cpp @@ -271,7 +271,7 @@ bool Device::saveFrame(const AVFrame* frame) QString absFilePath; QString fileDir(Config::getInstance().getRecordPath()); if (fileDir.isEmpty()) { - qWarning() << "please select record path!!!"; + qWarning() << "please select record save path!!!"; return false; } QDateTime dateTime = QDateTime::currentDateTime(); diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp index d947d03..095aa96 100644 --- a/QtScrcpy/dialog.cpp +++ b/QtScrcpy/dialog.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "dialog.h" #include "ui_dialog.h" @@ -136,14 +137,16 @@ void Dialog::on_startServerBtn_clicked() outLog("start server...", false); QString absFilePath; - QString fileDir(ui->recordPathEdt->text().trimmed()); - if (!fileDir.isEmpty()) { - QDateTime dateTime = QDateTime::currentDateTime(); - QString fileName = dateTime.toString("_yyyyMMdd_hhmmss_zzz"); - QString ext = ui->formatBox->currentText().trimmed(); - fileName = windowTitle() + fileName + "." + ext; - QDir dir(fileDir); - absFilePath = dir.absoluteFilePath(fileName); + if (ui->recordScreenCheck->isChecked()) { + QString fileDir(ui->recordPathEdt->text().trimmed()); + if (!fileDir.isEmpty()) { + QDateTime dateTime = QDateTime::currentDateTime(); + QString fileName = dateTime.toString("_yyyyMMdd_hhmmss_zzz"); + QString ext = ui->formatBox->currentText().trimmed(); + fileName = windowTitle() + fileName + "." + ext; + QDir dir(fileDir); + absFilePath = dir.absoluteFilePath(fileName); + } } quint32 bitRate = ui->bitRateBox->currentText().trimmed().toUInt(); @@ -343,3 +346,16 @@ void Dialog::on_applyScriptBtn_clicked() { m_deviceManage.updateScript(getGameScript(ui->gameBox->currentText())); } + +void Dialog::on_recordScreenCheck_clicked(bool checked) +{ + if (!checked) { + return; + } + + QString fileDir(ui->recordPathEdt->text().trimmed()); + if (fileDir.isEmpty()) { + qWarning() << "please select record save path!!!"; + ui->recordScreenCheck->setChecked(false); + } +} diff --git a/QtScrcpy/dialog.h b/QtScrcpy/dialog.h index 2f036de..d04645e 100644 --- a/QtScrcpy/dialog.h +++ b/QtScrcpy/dialog.h @@ -54,6 +54,8 @@ private slots: void on_applyScriptBtn_clicked(); + void on_recordScreenCheck_clicked(bool checked); + private: bool checkAdbRun(); void initUI(); diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui index a768349..0d4440a 100644 --- a/QtScrcpy/dialog.ui +++ b/QtScrcpy/dialog.ui @@ -195,7 +195,7 @@ - + 0 @@ -208,8 +208,15 @@ 0 - - + + + + record screen + + + + + 0 @@ -217,15 +224,12 @@ - background record - - - false + screen-off - - + + 0 @@ -233,15 +237,15 @@ - always on top + background record - + false - - + + 0 @@ -249,12 +253,15 @@ - screen-off + reverse connection + + + true - - + + 0 @@ -262,10 +269,10 @@ - reverse connection + always on top - true + false diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.qm b/QtScrcpy/res/i18n/QtScrcpy_en.qm index f8fd86bfdaf2232076c0a3c768c1747e6b7f9213..f73b8033ea1af9c87da3872d716401e3e5f5a63d 100644 GIT binary patch delta 438 zcmca0c};SHOnn*y+c#4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_en.ts @@ -16,22 +16,22 @@ file transfer failed - + install apk install apk - + file transfer file transfer - + wait current %1 to complete wait current %1 to complete - + %1 complete, save in %2 %1 complete, save in %2 @@ -41,7 +41,7 @@ %1 complete\n save in %2 - + %1 failed %1 failed @@ -49,128 +49,132 @@ Dialog - + Wireless Wireless - + wireless connect wireless connect - + wireless disconnect wireless disconnect - + Start Config Start Config - + record save path: record save path: - - + + select path select path - + record format: record format: - + + record screen + record screen + + + stop all server stop all server - + adb command: adb command: - + terminate terminate - + execute execute - + clear clear - + reverse connection reverse connection - auto enable - auto enable + auto enable - + background record background record - + screen-off screen-off - + apply apply - + max size: max size: - + always on top always on top - + refresh script refresh script - + get device IP get device IP - + USB line USB line - + stop server stop server - + start server start server - + device serial: device serial: @@ -179,17 +183,17 @@ Config - + bit rate: bit rate: - + start adbd start adbd - + refresh devices refresh devices @@ -280,7 +284,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 b5d1de87d7e8e6b3f3488372ce884bea844c3a7c..2a1e8848f5d1e72c9dd218c3312990f606430e85 100644 GIT binary patch delta 438 zcmbO&GE-!NOnndo+c#4N26j^hcAHQj9m8NIx`=^+RgWQ~+>(KT@gGB$b`t{wQyW8h z?jfLjBSVj-Gf=#Q(elwb1_riejP`O43=GVyi~&cd1I48nceP9c>W^jSzA6V)|BLxB z*8&Cx4h@z_r&~bz*{tkoT0rwwv9`Y!VqmCeC}FF3+yxYfVw=F{0@V1D?f9z}1_lN< zwigXfK$?NwL0XuBfrX9TUHd7}08jRwJ$*pYl4phM5`@47q-$WQ0L+qo6!peva`#r@1cmI#9?gJE<}k^qCw y=9!GrOq-uEZ(vm5hz|`ii}8;O_qSWO4q7;SVcAHQj9milMx`=^+)qo+R+>(KT@gGB$b`t{w(+-C6 z+(SV5W`-V3XP|fqqvfM>3=C{5813a87#Nt%83T?^2Z~EE?rNC?)F02xeN_&q{txqE zt_2JX99k@qPPc&avsu~Gw1DQ_VQqgc#K2I`P{LO6xC1*q{g+woT|3=9lz zY%dy|fHVW!n=L>GGO4jUNDDJCuyC-uYd-}V+7Q7TaUFlXWg7NGwBoTU+8faXPT$*qzA+Rt*4%i-8QphP}b zRWldRC)wNwv~L0pyvcoHzZ+0|36E1;2#~hpsWZOorG#>IC_uErAYYljB=` zSp?|AF#gOHQb6%@{I#zGfDSyzzw7cWAb%$R-OjB*hg``7Dw@a)WQj1SG8jhpBndF+ zY@W#|&7{QB_$p{ch<>R?qg1*M2T%nA8xV6RmX_ozq~;|i<)m(2!hC>n^Ay%r767VU BZFB$t diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.ts b/QtScrcpy/res/i18n/QtScrcpy_zh.ts index c79f3af..7f9721d 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_zh.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_zh.ts @@ -16,22 +16,22 @@ 文件传输失败 - + install apk 安装apk - + file transfer 文件传输 - + wait current %1 to complete 等待当前%1完成 - + %1 complete, save in %2 %1完成,保存在%2 @@ -41,7 +41,7 @@ %1完成\n 保存在 %2 - + %1 failed %1 失败 @@ -49,128 +49,132 @@ Dialog - + Wireless 无线 - + wireless connect 无线连接 - + wireless disconnect 无线断开 - + Start Config 启动配置 - + record save path: 录像保存路径: - - + + select path 选择路径 - + record format: 录制格式: - + + record screen + 录制屏幕 + + + stop all server 停止所有服务 - + adb command: adb命令: - + terminate 终止 - + execute 执行 - + clear 清理 - + reverse connection 反向连接 - auto enable - 自动启用脚本 + 自动启用脚本 - + background record 后台录制 - + screen-off 自动息屏 - + apply 应用脚本 - + max size: 最大尺寸: - + always on top 窗口置顶 - + refresh script 刷新脚本 - + get device IP 获取设备IP - + USB line USB线 - + stop server 停止服务 - + start server 启动服务 - + device serial: 设备序列号: @@ -179,17 +183,17 @@ 配置 - + bit rate: 比特率: - + start adbd 启动adbd - + refresh devices 刷新设备列表 @@ -280,7 +284,7 @@ 文件传输失败 - + file does not exist 文件不存在