From 710f566d2f4441941abc814b6edc503d1ddc9f2d Mon Sep 17 00:00:00 2001 From: Barry <870709864@qq.com> Date: Sat, 22 Jun 2019 15:11:30 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/device/device.cpp | 15 ++++-- QtScrcpy/device/filehandler/filehandler.cpp | 24 ++++++--- QtScrcpy/device/filehandler/filehandler.h | 7 ++- QtScrcpy/devicemanage/devicemanage.cpp | 11 ++++ QtScrcpy/devicemanage/devicemanage.h | 1 + QtScrcpy/dialog.cpp | 5 ++ QtScrcpy/dialog.h | 2 + QtScrcpy/dialog.ui | 7 +++ QtScrcpy/res/i18n/QtScrcpy_en.qm | Bin 2814 -> 2973 bytes QtScrcpy/res/i18n/QtScrcpy_en.ts | 52 +++++++++++++++---- QtScrcpy/res/i18n/QtScrcpy_zh.qm | Bin 2213 -> 2372 bytes QtScrcpy/res/i18n/QtScrcpy_zh.ts | 54 ++++++++++++++++---- TODO.md | 9 ++-- 13 files changed, 148 insertions(+), 39 deletions(-) diff --git a/QtScrcpy/device/device.cpp b/QtScrcpy/device/device.cpp index e2e668f..a4f0ce0 100644 --- a/QtScrcpy/device/device.cpp +++ b/QtScrcpy/device/device.cpp @@ -28,6 +28,7 @@ Device::Device(DeviceParams params, QObject *parent) m_fileHandler = new FileHandler(this); m_controller = new Controller(this); m_videoForm = new VideoForm(); + m_videoForm->setSerial(m_params.serial); if (m_controller) { m_videoForm->setController(m_controller); } @@ -94,15 +95,21 @@ void Device::initSignals() connect(m_controller, &Controller::grabCursor, m_videoForm, &VideoForm::onGrabCursor); } if (m_fileHandler) { - connect(m_fileHandler, &FileHandler::fileHandlerResult, this, [this](FileHandler::FILE_HANDLER_RESULT processResult){ + connect(m_fileHandler, &FileHandler::fileHandlerResult, this, [this](FileHandler::FILE_HANDLER_RESULT processResult, bool isApk){ + QString tips = ""; + if (isApk) { + tips = tr("install apk"); + } else { + tips = tr("file transfer"); + } if (FileHandler::FAR_IS_RUNNING == processResult && m_videoForm) { - QMessageBox::warning(m_videoForm, "QtScrcpy", tr("wait current file transfer to complete"), QMessageBox::Ok); + QMessageBox::warning(m_videoForm, "QtScrcpy", tr("wait current %1 to complete").arg(tips), QMessageBox::Ok); } if (FileHandler::FAR_SUCCESS_EXEC == processResult && m_videoForm) { - QMessageBox::information(m_videoForm, "QtScrcpy", tr("file transfer complete"), QMessageBox::Ok); + QMessageBox::information(m_videoForm, "QtScrcpy", tr("%1 complete, save in %2").arg(tips).arg(m_fileHandler->getDevicePath()), QMessageBox::Ok); } if (FileHandler::FAR_ERROR_EXEC == processResult && m_videoForm) { - QMessageBox::information(m_videoForm, "QtScrcpy", tr("file transfer failed"), QMessageBox::Ok); + QMessageBox::information(m_videoForm, "QtScrcpy", tr("%1 failed").arg(tips), QMessageBox::Ok); } }); } diff --git a/QtScrcpy/device/filehandler/filehandler.cpp b/QtScrcpy/device/filehandler/filehandler.cpp index 548dc88..c2b269f 100644 --- a/QtScrcpy/device/filehandler/filehandler.cpp +++ b/QtScrcpy/device/filehandler/filehandler.cpp @@ -10,10 +10,10 @@ FileHandler::FileHandler(QObject *parent) case AdbProcess::AER_ERROR_START: case AdbProcess::AER_ERROR_EXEC: case AdbProcess::AER_ERROR_MISSING_BINARY: - emit fileHandlerResult(FAR_ERROR_EXEC); + emit fileHandlerResult(FAR_ERROR_EXEC, m_isApk); break; case AdbProcess::AER_SUCCESS_EXEC: - emit fileHandlerResult(FAR_SUCCESS_EXEC); + emit fileHandlerResult(FAR_SUCCESS_EXEC, m_isApk); break; default: break; @@ -26,20 +26,32 @@ FileHandler::~FileHandler() } -void FileHandler::pushFileRequest(const QString &serial, const QString &file) +void FileHandler::pushFileRequest(const QString &serial, const QString &file, const QString& devicePath) { if (m_adb.isRuning()) { - emit fileHandlerResult(FAR_IS_RUNNING); + emit fileHandlerResult(FAR_IS_RUNNING, false); return; } - m_adb.push(serial, file, DEVICE_SDCARD_PATH); + m_devicePath = devicePath; + if (m_devicePath.isEmpty()) { + m_devicePath = DEVICE_SDCARD_PATH; + } + m_isApk = false; + m_adb.push(serial, file, m_devicePath); } void FileHandler::installApkRequest(const QString &serial, const QString &apkFile) { if (m_adb.isRuning()) { - emit fileHandlerResult(FAR_IS_RUNNING); + emit fileHandlerResult(FAR_IS_RUNNING, true); return; } + m_devicePath = ""; + m_isApk = true; m_adb.install(serial, apkFile); } + +const QString &FileHandler::getDevicePath() +{ + return m_devicePath; +} diff --git a/QtScrcpy/device/filehandler/filehandler.h b/QtScrcpy/device/filehandler/filehandler.h index 1c67c9c..3a2023c 100644 --- a/QtScrcpy/device/filehandler/filehandler.h +++ b/QtScrcpy/device/filehandler/filehandler.h @@ -17,14 +17,17 @@ public: FileHandler(QObject *parent = nullptr); virtual ~FileHandler(); - void pushFileRequest(const QString& serial, const QString& file); + void pushFileRequest(const QString& serial, const QString& file, const QString& devicePath = ""); void installApkRequest(const QString& serial, const QString& apkFile); + const QString &getDevicePath(); signals: - void fileHandlerResult(FILE_HANDLER_RESULT processResult); + void fileHandlerResult(FILE_HANDLER_RESULT processResult, bool isApk = false); private: AdbProcess m_adb; + bool m_isApk = false; + QString m_devicePath = ""; }; #endif // FILEHANDLER_H diff --git a/QtScrcpy/devicemanage/devicemanage.cpp b/QtScrcpy/devicemanage/devicemanage.cpp index d197b64..476edbf 100644 --- a/QtScrcpy/devicemanage/devicemanage.cpp +++ b/QtScrcpy/devicemanage/devicemanage.cpp @@ -60,6 +60,17 @@ bool DeviceManage::disconnectDevice(const QString &serial) return ret; } +void DeviceManage::disconnectAllDevice() +{ + QMapIterator> i(m_devices); + while (i.hasNext()) { + i.next(); + if (i.value()) { + i.value()->deleteLater(); + } + } +} + void DeviceManage::onDeviceDisconnect(QString serial) { if (!serial.isEmpty() && m_devices.contains(serial)) { diff --git a/QtScrcpy/devicemanage/devicemanage.h b/QtScrcpy/devicemanage/devicemanage.h index e45bfdf..ddcbd1f 100644 --- a/QtScrcpy/devicemanage/devicemanage.h +++ b/QtScrcpy/devicemanage/devicemanage.h @@ -15,6 +15,7 @@ public: bool connectDevice(Device::DeviceParams params); bool disconnectDevice(const QString &serial); + void disconnectAllDevice(); protected slots: void onDeviceDisconnect(QString serial); diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp index 6aeaea9..afca0c1 100644 --- a/QtScrcpy/dialog.cpp +++ b/QtScrcpy/dialog.cpp @@ -260,3 +260,8 @@ void Dialog::on_clearOut_clicked() { ui->outEdit->clear(); } + +void Dialog::on_stopAllServerBtn_clicked() +{ + m_deviceManage.disconnectAllDevice(); +} diff --git a/QtScrcpy/dialog.h b/QtScrcpy/dialog.h index 6536f08..536223c 100644 --- a/QtScrcpy/dialog.h +++ b/QtScrcpy/dialog.h @@ -47,6 +47,8 @@ private slots: void on_clearOut_clicked(); + void on_stopAllServerBtn_clicked(); + private: bool checkAdbRun(); void initUI(); diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui index cd74319..e3b8afa 100644 --- a/QtScrcpy/dialog.ui +++ b/QtScrcpy/dialog.ui @@ -293,6 +293,13 @@ + + + + stop all server + + + diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.qm b/QtScrcpy/res/i18n/QtScrcpy_en.qm index b634fc0a8f848c4708f5de2ca226c291072c4b30..3d8c7c7e97c3463f3c73923982ecd0271889b2d2 100644 GIT binary patch delta 705 zcmZ9IO=uHQ6ot>^XC^<|NJ)((7{)~wHbI+!l|Z2qE267zTnG{!(is?=Ov22V23({{ zQPe8MqJj_*SE5}+t0G0PsMUo~3ZdW+ZYqjeK~PW-70{##HNs4 zn&JQF2<=p?0yp9y}#i(n0pP>T?wzGbyLvi zJ-yrs;IdeIcb0|?aiU{@fG^_n&tp74B7Pjru|nFLd{5&?()hy*H0qJ2&OhMkUFk#j z5<#=l&wY6gVEgi!7i@p&Yv$Q6+J5)1CVhweyD}>Ke*2XL59;tD5Wl$z@H`DX+jEJH znP5HqiGjWcXOpjJ)U$4RYL5F89kDEfNIN@jwZa51hV&az>Z+lc)>YQ+p|@x5F<4j! z0x37q+mJvSG72c8gbIpKVRNN;WH_?+=Xu1F#+7s{ndQMJ{SY$;V$ z)(tt4k(~PhwW=3X!2xtSfXR6wQukA#DSA;IYVV0cBf&w-gqy?~glpWJYrORum9lLr zhNY=yyTitngcj8beTwu^ILz>xI;a~_%T|g-S*Z-Si+d-7u9(}2+3(u2AvU7uwp=)7 snyO*TiS+bwSJ;z|Gmy)S6Hj^m0d6RsegFUf delta 589 zcmaKnO-NKx9L3L@_i^V##?5n#BzY|gb;^ZeH4s#0L=hpBi@*k^={|fiUp(J5ZDJy7 z6BdF+5CjzknJxxKq9Vi$TSh2BwKNng23(a0if2X;TGZn4fA^eofB$nIHEuMFn8icT zU-bh*gYmly@JAsI_i>)bfrh7mwuZsz4ZwE~h4c*dYZz`l4k%?s1WyA-s}fuIM1N{) ziUH-wuE&7tD!sE0m^-G1zBKdRSM@`XdLW`*=>AT9Nf&k-Q1q=ESAX0lAa0C=dkB=` zWOR{%>tgubU0xg$6L(&-;C`{xwgBic@#j>W=Ze4crw(A!Uy3uYR|4ui@B_qVO{Ir_|Yf6-A#K73CFXNdDoR0&-#m8p7WVnxm{$nO$%a- A Device - wait current file transfer to complete - wait current file transfer to complete + wait current file transfer to complete - file transfer complete - file transfer complete + file transfer complete - file transfer failed - file transfer failed + 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 + + + %1 complete + save in %2 + %1 complete\n save in %2 + + + + %1 failed + %1 failed @@ -63,22 +90,27 @@ not display - + + stop all server + stop all server + + + adb command: adb command: - + terminate terminate - + execute execute - + clear clear diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.qm b/QtScrcpy/res/i18n/QtScrcpy_zh.qm index ab2509e14c28e9c8151c63ddb8eac8d0fe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git a/QtScrcpy/res/i18n/QtScrcpy_zh.ts b/QtScrcpy/res/i18n/QtScrcpy_zh.ts index 5123c1f..4b1be8d 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_zh.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_zh.ts @@ -4,19 +4,46 @@ Device - wait current file transfer to complete - 等待当前文件传输完成 + 等待当前文件传输完成 - file transfer complete - 文件传输完成 + 文件传输完成 - file transfer failed - 文件传输失败 + 文件传输失败 + + + + install apk + 安装apk + + + + file transfer + 文件传输 + + + + wait current %1 to complete + 等待当前%1完成 + + + + %1 complete, save in %2 + %1完成,保存在%2 + + + %1 complete + save in %2 + %1完成\n 保存在 %2 + + + + %1 failed + %1 失败 @@ -63,29 +90,34 @@ 仅后台录制 - + + stop all server + 停止所有服务 + + + adb command: adb命令行: - + terminate 终止 - + execute 执行 - + clear 清理 always top - 置顶 + 窗口置顶 diff --git a/TODO.md b/TODO.md index f1c3418..29e57b5 100644 --- a/TODO.md +++ b/TODO.md @@ -1,18 +1,15 @@ ͬscrcpy b91ecf52256da73f5c8dca04fb82c13ec826cbd7 # TODO +## ȼ 0. 루serverҪΪapkΪһ뷨ݲʵ֣ 1. ¼ϵ b35733edb6df2a00b6af9b1c98627d344c377963 2. [֡Ϊ̬ãǾ̬](https://github.com/Genymobile/scrcpy/commit/ebccb9f6cc111e8acfbe10d656cac5c1f1b744a0) 3. [߳ͳ֡](https://github.com/Genymobile/scrcpy/commit/e2a272bf99ecf48fcb050177113f903b3fb323c4) 4. uiṩshow touch -5. קļְװļƣʾ· -6. ֹͣз -7. ק -8. /ֹͣΪ豸/Ͽ豸 -9. öΪö -10. jpg +## ȼ +0. [Ϊjpg](https://blog.csdn.net/m0_37684310/article/details/77950390) # mark [ffmpeg](https://www.cnblogs.com/wainiwann/p/4204230.html)