mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 19:44:59 +00:00
update:更新语言
This commit is contained in:
parent
48a05f82be
commit
b7b826c23d
13 changed files with 148 additions and 39 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -60,6 +60,17 @@ bool DeviceManage::disconnectDevice(const QString &serial)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void DeviceManage::disconnectAllDevice()
|
||||
{
|
||||
QMapIterator<QString, QPointer<Device>> 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)) {
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
|
||||
bool connectDevice(Device::DeviceParams params);
|
||||
bool disconnectDevice(const QString &serial);
|
||||
void disconnectAllDevice();
|
||||
|
||||
protected slots:
|
||||
void onDeviceDisconnect(QString serial);
|
||||
|
|
|
@ -260,3 +260,8 @@ void Dialog::on_clearOut_clicked()
|
|||
{
|
||||
ui->outEdit->clear();
|
||||
}
|
||||
|
||||
void Dialog::on_stopAllServerBtn_clicked()
|
||||
{
|
||||
m_deviceManage.disconnectAllDevice();
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ private slots:
|
|||
|
||||
void on_clearOut_clicked();
|
||||
|
||||
void on_stopAllServerBtn_clicked();
|
||||
|
||||
private:
|
||||
bool checkAdbRun();
|
||||
void initUI();
|
||||
|
|
|
@ -293,6 +293,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="stopAllServerBtn">
|
||||
<property name="text">
|
||||
<string>stop all server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Binary file not shown.
|
@ -4,19 +4,46 @@
|
|||
<context>
|
||||
<name>Device</name>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="92"/>
|
||||
<source>wait current file transfer to complete</source>
|
||||
<translation>wait current file transfer to complete</translation>
|
||||
<translation type="vanished">wait current file transfer to complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="95"/>
|
||||
<source>file transfer complete</source>
|
||||
<translation>file transfer complete</translation>
|
||||
<translation type="vanished">file transfer complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="98"/>
|
||||
<source>file transfer failed</source>
|
||||
<translation>file transfer failed</translation>
|
||||
<translation type="vanished">file transfer failed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="101"/>
|
||||
<source>install apk</source>
|
||||
<translation>install apk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="103"/>
|
||||
<source>file transfer</source>
|
||||
<translation>file transfer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="106"/>
|
||||
<source>wait current %1 to complete</source>
|
||||
<translation>wait current %1 to complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="109"/>
|
||||
<source>%1 complete, save in %2</source>
|
||||
<translation>%1 complete, save in %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 complete
|
||||
save in %2</source>
|
||||
<translation type="vanished">%1 complete\n save in %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="112"/>
|
||||
<source>%1 failed</source>
|
||||
<translation>%1 failed</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -63,22 +90,27 @@
|
|||
<translation>not display</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="308"/>
|
||||
<location filename="../../dialog.ui" line="299"/>
|
||||
<source>stop all server</source>
|
||||
<translation>stop all server</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="315"/>
|
||||
<source>adb command:</source>
|
||||
<translation>adb command:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="318"/>
|
||||
<location filename="../../dialog.ui" line="325"/>
|
||||
<source>terminate</source>
|
||||
<translation>terminate</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="325"/>
|
||||
<location filename="../../dialog.ui" line="332"/>
|
||||
<source>execute</source>
|
||||
<translation>execute</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="339"/>
|
||||
<location filename="../../dialog.ui" line="346"/>
|
||||
<source>clear</source>
|
||||
<translation>clear</translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -4,19 +4,46 @@
|
|||
<context>
|
||||
<name>Device</name>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="92"/>
|
||||
<source>wait current file transfer to complete</source>
|
||||
<translation>等待当前文件传输完成</translation>
|
||||
<translation type="vanished">等待当前文件传输完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="95"/>
|
||||
<source>file transfer complete</source>
|
||||
<translation>文件传输完成</translation>
|
||||
<translation type="vanished">文件传输完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="98"/>
|
||||
<source>file transfer failed</source>
|
||||
<translation>文件传输失败</translation>
|
||||
<translation type="vanished">文件传输失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="101"/>
|
||||
<source>install apk</source>
|
||||
<translation>安装apk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="103"/>
|
||||
<source>file transfer</source>
|
||||
<translation>文件传输</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="106"/>
|
||||
<source>wait current %1 to complete</source>
|
||||
<translation>等待当前%1完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="109"/>
|
||||
<source>%1 complete, save in %2</source>
|
||||
<translation>%1完成,保存在%2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 complete
|
||||
save in %2</source>
|
||||
<translation type="vanished">%1完成\n 保存在 %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../device/device.cpp" line="112"/>
|
||||
<source>%1 failed</source>
|
||||
<translation>%1 失败</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -63,29 +90,34 @@
|
|||
<translation>仅后台录制</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="308"/>
|
||||
<location filename="../../dialog.ui" line="299"/>
|
||||
<source>stop all server</source>
|
||||
<translation>停止所有服务</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="315"/>
|
||||
<source>adb command:</source>
|
||||
<translation>adb命令行:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="318"/>
|
||||
<location filename="../../dialog.ui" line="325"/>
|
||||
<source>terminate</source>
|
||||
<translation>终止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="325"/>
|
||||
<location filename="../../dialog.ui" line="332"/>
|
||||
<source>execute</source>
|
||||
<translation>执行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="339"/>
|
||||
<location filename="../../dialog.ui" line="346"/>
|
||||
<source>clear</source>
|
||||
<translation>清理</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="169"/>
|
||||
<source>always top</source>
|
||||
<translation>置顶</translation>
|
||||
<translation>窗口置顶</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../dialog.ui" line="199"/>
|
||||
|
|
9
TODO.md
9
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue