mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-02 05:48:38 +00:00
feat: sdcard path to config
This commit is contained in:
parent
eedc379614
commit
c45e8e4597
6 changed files with 21 additions and 16 deletions
|
@ -120,7 +120,7 @@ void Device::initSignals()
|
|||
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("%1 complete, save in %2").arg(tips).arg(m_fileHandler->getDevicePath()), QMessageBox::Ok);
|
||||
QMessageBox::information(m_videoForm, "QtScrcpy", tr("%1 complete, save in %2").arg(tips).arg(Config::getInstance().getPushFilePath()), QMessageBox::Ok);
|
||||
}
|
||||
if (FileHandler::FAR_ERROR_EXEC == processResult && m_videoForm) {
|
||||
QMessageBox::information(m_videoForm, "QtScrcpy", tr("%1 failed").arg(tips), QMessageBox::Ok);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "filehandler.h"
|
||||
|
||||
#define DEVICE_SDCARD_PATH "/sdcard/"
|
||||
|
||||
FileHandler::FileHandler(QObject *parent)
|
||||
: QObject (parent)
|
||||
{
|
||||
|
@ -32,12 +30,9 @@ void FileHandler::pushFileRequest(const QString &serial, const QString &file, co
|
|||
emit fileHandlerResult(FAR_IS_RUNNING, false);
|
||||
return;
|
||||
}
|
||||
m_devicePath = devicePath;
|
||||
if (m_devicePath.isEmpty()) {
|
||||
m_devicePath = DEVICE_SDCARD_PATH;
|
||||
}
|
||||
|
||||
m_isApk = false;
|
||||
m_adb.push(serial, file, m_devicePath);
|
||||
m_adb.push(serial, file, devicePath);
|
||||
}
|
||||
|
||||
void FileHandler::installApkRequest(const QString &serial, const QString &apkFile)
|
||||
|
@ -46,12 +41,6 @@ void FileHandler::installApkRequest(const QString &serial, const QString &apkFil
|
|||
emit fileHandlerResult(FAR_IS_RUNNING, true);
|
||||
return;
|
||||
}
|
||||
m_devicePath = "";
|
||||
m_isApk = true;
|
||||
m_adb.install(serial, apkFile);
|
||||
}
|
||||
|
||||
const QString &FileHandler::getDevicePath()
|
||||
{
|
||||
return m_devicePath;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "toolform.h"
|
||||
#include "controller.h"
|
||||
#include "filehandler.h"
|
||||
#include "config.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "libavutil/frame.h"
|
||||
|
@ -410,5 +411,5 @@ void VideoForm::dropEvent(QDropEvent *event)
|
|||
m_fileHandler->installApkRequest(m_serial, file);
|
||||
return;
|
||||
}
|
||||
m_fileHandler->pushFileRequest(m_serial, file);
|
||||
m_fileHandler->pushFileRequest(m_serial, file, Config::getInstance().getPushFilePath());
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#define COMMON_RECORD_KEY "RecordPath"
|
||||
#define COMMON_RECORD_DEF ""
|
||||
|
||||
#define COMMON_PUSHFILE_KEY "PushFilePath"
|
||||
#define COMMON_PUSHFILE_DEF "/sdcard/"
|
||||
|
||||
#define COMMON_SERVER_VERSION_KEY "ServerVersion"
|
||||
#define COMMON_SERVER_VERSION_DEF "1.12.1"
|
||||
|
||||
|
@ -102,6 +105,15 @@ int Config::getSkin()
|
|||
return skin;
|
||||
}
|
||||
|
||||
QString Config::getPushFilePath()
|
||||
{
|
||||
QString pushFile;
|
||||
m_settings->beginGroup(GROUP_COMMON);
|
||||
pushFile = m_settings->value(COMMON_PUSHFILE_KEY, COMMON_PUSHFILE_DEF).toString();
|
||||
m_settings->endGroup();
|
||||
return pushFile;
|
||||
}
|
||||
|
||||
QString Config::getTitle()
|
||||
{
|
||||
QString title;
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
int getMaxFps();
|
||||
int getDesktopOpenGL();
|
||||
int getSkin();
|
||||
QString getPushFilePath();
|
||||
|
||||
private:
|
||||
explicit Config(QObject *parent = nullptr);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
[common]
|
||||
# 窗口标题
|
||||
WindowTitle=QtScrcpy
|
||||
# 录制文件路径
|
||||
# 录制文件保存路径
|
||||
RecordPath=
|
||||
# 推送到安卓设备的文件保存路径
|
||||
PushFilePath=/sdcard/
|
||||
# 最大fps(仅支持Android 10以上)
|
||||
MaxFps=60
|
||||
# scrcpy-server的版本号(不要修改)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue