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