Merge pull request #715 from barry-ran/dev

sync dev
This commit is contained in:
Barry 2022-10-31 10:39:15 +08:00 committed by GitHub
commit 6692ee15d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 6 deletions

View file

@ -68,7 +68,7 @@ jobs:
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:
name: ${{ steps.package.outputs.package-name }}.zip name: ${{ steps.package.outputs.package-name }}.zip
path: ci/build/${{ steps.package.outputs.package-name }}.app path: ci/build/${{ steps.package.outputs.package-name }}.dmg
# Upload to release # Upload to release
- name: Upload Release - name: Upload Release
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')

View file

@ -163,6 +163,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES} set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES}
util/mousetap/cocoamousetap.h util/mousetap/cocoamousetap.h
util/mousetap/cocoamousetap.mm util/mousetap/cocoamousetap.mm
util/path.h
util/path.mm
) )
endif() endif()
source_group(util FILES ${QC_UTIL_SOURCES}) source_group(util FILES ${QC_UTIL_SOURCES})

@ -1 +1 @@
Subproject commit f81d3696cb79964e073415798bc070415337877d Subproject commit 9b81a312ad2e8157c48dc042e973a81702357509

View file

@ -292,7 +292,7 @@ void Dialog::on_startServerBtn_clicked()
{ {
outLog("start server...", false); outLog("start server...", false);
// this is ok that "native" toUshort is 0 // this is ok that "original" toUshort is 0
quint16 videoSize = ui->maxSizeBox->currentText().trimmed().toUShort(); quint16 videoSize = ui->maxSizeBox->currentText().trimmed().toUShort();
qsc::DeviceParams params; qsc::DeviceParams params;
params.serial = ui->serialBox->currentText().trimmed(); params.serial = ui->serialBox->currentText().trimmed();

View file

@ -4,6 +4,9 @@
#include <QDebug> #include <QDebug>
#include "config.h" #include "config.h"
#ifdef Q_OS_OSX
#include "path.h"
#endif
#define GROUP_COMMON "common" #define GROUP_COMMON "common"
@ -21,7 +24,7 @@
#define COMMON_SERVER_PATH_DEF "/data/local/tmp/scrcpy-server.jar" #define COMMON_SERVER_PATH_DEF "/data/local/tmp/scrcpy-server.jar"
#define COMMON_MAX_FPS_KEY "MaxFps" #define COMMON_MAX_FPS_KEY "MaxFps"
#define COMMON_MAX_FPS_DEF 60 #define COMMON_MAX_FPS_DEF 0
#define COMMON_DESKTOP_OPENGL_KEY "UseDesktopOpenGL" #define COMMON_DESKTOP_OPENGL_KEY "UseDesktopOpenGL"
#define COMMON_DESKTOP_OPENGL_DEF -1 #define COMMON_DESKTOP_OPENGL_DEF -1
@ -125,7 +128,15 @@ const QString &Config::getConfigPath()
QFileInfo fileInfo(s_configPath); QFileInfo fileInfo(s_configPath);
if (s_configPath.isEmpty() || !fileInfo.isDir()) { if (s_configPath.isEmpty() || !fileInfo.isDir()) {
// default application dir // default application dir
// mac系统当从finder打开app时默认工作目录不再是可执行程序的目录了而是"/"
// 而Qt的获取工作目录的api都依赖QCoreApplication的初始化所以使用mac api获取当前目录
#ifdef Q_OS_OSX
// get */QtScrcpy.app path
s_configPath = Path::GetCurrentPath();
s_configPath += "/Contents/MacOS/config";
#else
s_configPath = "config"; s_configPath = "config";
#endif
} }
} }
return s_configPath; return s_configPath;
@ -227,7 +238,7 @@ QString Config::getServerVersion()
int Config::getMaxFps() int Config::getMaxFps()
{ {
int fps = 60; int fps = 0;
m_settings->beginGroup(GROUP_COMMON); m_settings->beginGroup(GROUP_COMMON);
fps = m_settings->value(COMMON_MAX_FPS_KEY, COMMON_MAX_FPS_DEF).toInt(); fps = m_settings->value(COMMON_MAX_FPS_KEY, COMMON_MAX_FPS_DEF).toInt();
m_settings->endGroup(); m_settings->endGroup();

6
QtScrcpy/util/path.h Normal file
View file

@ -0,0 +1,6 @@
#pragma once
class Path {
public:
static const char* GetCurrentPath();
};

7
QtScrcpy/util/path.mm Normal file
View file

@ -0,0 +1,7 @@
#include "path.h"
#import <Cocoa/Cocoa.h>
const char* Path::GetCurrentPath() {
return [[[NSBundle mainBundle] bundlePath] UTF8String];
}

View file

@ -4,7 +4,7 @@ WindowTitle=QtScrcpy
# 推送到安卓设备的文件保存路径(必须以/结尾) # 推送到安卓设备的文件保存路径(必须以/结尾)
PushFilePath=/sdcard/ PushFilePath=/sdcard/
# 最大fps仅支持Android 10以上 # 最大fps仅支持Android 10以上
MaxFps=60 MaxFps=0
# 是否渲染过期视频帧(跳过过期视频帧意味着更低的延迟) # 是否渲染过期视频帧(跳过过期视频帧意味着更低的延迟)
RenderExpiredFrames=0 RenderExpiredFrames=0
# 视频解码方式:-1 自动0 软解1 dx硬解2 opengl硬解 # 视频解码方式:-1 自动0 软解1 dx硬解2 opengl硬解