Skip to content

Commit 6692ee1

Browse files
authored
Merge pull request #715 from barry-ran/dev
sync dev
2 parents d8f16d4 + e981a17 commit 6692ee1

File tree

8 files changed

+32
-6
lines changed

8 files changed

+32
-6
lines changed

.github/workflows/macos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions/upload-artifact@v1
6969
with:
7070
name: ${{ steps.package.outputs.package-name }}.zip
71-
path: ci/build/${{ steps.package.outputs.package-name }}.app
71+
path: ci/build/${{ steps.package.outputs.package-name }}.dmg
7272
# Upload to release
7373
- name: Upload Release
7474
if: startsWith(github.ref, 'refs/tags/')

QtScrcpy/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
163163
set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES}
164164
util/mousetap/cocoamousetap.h
165165
util/mousetap/cocoamousetap.mm
166+
util/path.h
167+
util/path.mm
166168
)
167169
endif()
168170
source_group(util FILES ${QC_UTIL_SOURCES})

QtScrcpy/ui/dialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void Dialog::on_startServerBtn_clicked()
292292
{
293293
outLog("start server...", false);
294294

295-
// this is ok that "native" toUshort is 0
295+
// this is ok that "original" toUshort is 0
296296
quint16 videoSize = ui->maxSizeBox->currentText().trimmed().toUShort();
297297
qsc::DeviceParams params;
298298
params.serial = ui->serialBox->currentText().trimmed();

QtScrcpy/util/config.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include <QDebug>
55

66
#include "config.h"
7+
#ifdef Q_OS_OSX
8+
#include "path.h"
9+
#endif
710

811
#define GROUP_COMMON "common"
912

@@ -21,7 +24,7 @@
2124
#define COMMON_SERVER_PATH_DEF "/data/local/tmp/scrcpy-server.jar"
2225

2326
#define COMMON_MAX_FPS_KEY "MaxFps"
24-
#define COMMON_MAX_FPS_DEF 60
27+
#define COMMON_MAX_FPS_DEF 0
2528

2629
#define COMMON_DESKTOP_OPENGL_KEY "UseDesktopOpenGL"
2730
#define COMMON_DESKTOP_OPENGL_DEF -1
@@ -125,7 +128,15 @@ const QString &Config::getConfigPath()
125128
QFileInfo fileInfo(s_configPath);
126129
if (s_configPath.isEmpty() || !fileInfo.isDir()) {
127130
// default application dir
131+
// mac系统当从finder打开app时,默认工作目录不再是可执行程序的目录了,而是"/"
132+
// 而Qt的获取工作目录的api都依赖QCoreApplication的初始化,所以使用mac api获取当前目录
133+
#ifdef Q_OS_OSX
134+
// get */QtScrcpy.app path
135+
s_configPath = Path::GetCurrentPath();
136+
s_configPath += "/Contents/MacOS/config";
137+
#else
128138
s_configPath = "config";
139+
#endif
129140
}
130141
}
131142
return s_configPath;
@@ -227,7 +238,7 @@ QString Config::getServerVersion()
227238

228239
int Config::getMaxFps()
229240
{
230-
int fps = 60;
241+
int fps = 0;
231242
m_settings->beginGroup(GROUP_COMMON);
232243
fps = m_settings->value(COMMON_MAX_FPS_KEY, COMMON_MAX_FPS_DEF).toInt();
233244
m_settings->endGroup();

QtScrcpy/util/path.h

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
class Path {
4+
public:
5+
static const char* GetCurrentPath();
6+
};

QtScrcpy/util/path.mm

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "path.h"
2+
3+
#import <Cocoa/Cocoa.h>
4+
5+
const char* Path::GetCurrentPath() {
6+
return [[[NSBundle mainBundle] bundlePath] UTF8String];
7+
}

config/config.ini

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

0 commit comments

Comments
 (0)