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 b634fc0..3d8c7c7 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 112b9c1..d0807aa 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_en.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_en.ts @@ -4,19 +4,46 @@ 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 ab2509e..8cd939a 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 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)