mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +00:00
parent
3544ec34d6
commit
0626335391
4 changed files with 21 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <QProcess>
|
||||
|
||||
#include "adbprocess.h"
|
||||
#include "config.h"
|
||||
|
||||
QString AdbProcess::s_adbPath = "";
|
||||
|
||||
|
@ -25,9 +26,14 @@ const QString &AdbProcess::getAdbPath()
|
|||
if (s_adbPath.isEmpty()) {
|
||||
s_adbPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_ADB_PATH"));
|
||||
QFileInfo fileInfo(s_adbPath);
|
||||
if (s_adbPath.isEmpty() || !fileInfo.isFile()) {
|
||||
s_adbPath = Config::getInstance().getAdbPath();
|
||||
}
|
||||
fileInfo = s_adbPath;
|
||||
if (s_adbPath.isEmpty() || !fileInfo.isFile()) {
|
||||
s_adbPath = QCoreApplication::applicationDirPath() + "/adb";
|
||||
}
|
||||
qInfo("adb path: %s", QDir(s_adbPath).absolutePath().toUtf8().data());
|
||||
}
|
||||
return s_adbPath;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#define COMMON_RENDER_EXPIRED_FRAMES_KEY "RenderExpiredFrames"
|
||||
#define COMMON_RENDER_EXPIRED_FRAMES_DEF 0
|
||||
|
||||
#define COMMON_ADB_PATH_KEY "AdbPath"
|
||||
#define COMMON_ADB_PATH_DEF ""
|
||||
|
||||
// user data
|
||||
#define COMMON_RECORD_KEY "RecordPath"
|
||||
#define COMMON_RECORD_DEF ""
|
||||
|
@ -253,6 +256,15 @@ QString Config::getServerPath()
|
|||
return serverPath;
|
||||
}
|
||||
|
||||
QString Config::getAdbPath()
|
||||
{
|
||||
QString adbPath;
|
||||
m_settings->beginGroup(GROUP_COMMON);
|
||||
adbPath = m_settings->value(COMMON_ADB_PATH_KEY, COMMON_ADB_PATH_DEF).toString();
|
||||
m_settings->endGroup();
|
||||
return adbPath;
|
||||
}
|
||||
|
||||
QString Config::getTitle()
|
||||
{
|
||||
QString title;
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
int getRenderExpiredFrames();
|
||||
QString getPushFilePath();
|
||||
QString getServerPath();
|
||||
QString getAdbPath();
|
||||
|
||||
// user data
|
||||
QString getRecordPath();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
[common]
|
||||
# 窗口标题
|
||||
WindowTitle=QtScrcpy
|
||||
# 录制文件保存路径(必须以/作为分隔符)
|
||||
RecordPath=
|
||||
# 推送到安卓设备的文件保存路径(必须以/结尾)
|
||||
PushFilePath=/sdcard/
|
||||
# 最大fps(仅支持Android 10以上)
|
||||
|
@ -15,3 +13,5 @@ UseDesktopOpenGL=-1
|
|||
ServerVersion=1.12.1
|
||||
# scrcpy-server推送到安卓设备的路径
|
||||
ServerPath=/data/local/tmp/scrcpy-server.jar
|
||||
# 自定义adb路径,例如D:/android/tools/adb.exe
|
||||
AdbPath=
|
||||
|
|
Loading…
Add table
Reference in a new issue