Skip to content

Commit

Permalink
Merge pull request #715 from barry-ran/dev
Browse files Browse the repository at this point in the history
sync dev
  • Loading branch information
barry-ran authored Oct 31, 2022
2 parents d8f16d4 + e981a17 commit 6692ee1
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- uses: actions/upload-artifact@v1
with:
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
- name: Upload Release
if: startsWith(github.ref, 'refs/tags/')
Expand Down
2 changes: 2 additions & 0 deletions QtScrcpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES}
util/mousetap/cocoamousetap.h
util/mousetap/cocoamousetap.mm
util/path.h
util/path.mm
)
endif()
source_group(util FILES ${QC_UTIL_SOURCES})
Expand Down
2 changes: 1 addition & 1 deletion QtScrcpy/QtScrcpyCore
2 changes: 1 addition & 1 deletion QtScrcpy/ui/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void Dialog::on_startServerBtn_clicked()
{
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();
qsc::DeviceParams params;
params.serial = ui->serialBox->currentText().trimmed();
Expand Down
15 changes: 13 additions & 2 deletions QtScrcpy/util/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <QDebug>

#include "config.h"
#ifdef Q_OS_OSX
#include "path.h"
#endif

#define GROUP_COMMON "common"

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

#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_DEF -1
Expand Down Expand Up @@ -125,7 +128,15 @@ const QString &Config::getConfigPath()
QFileInfo fileInfo(s_configPath);
if (s_configPath.isEmpty() || !fileInfo.isDir()) {
// 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";
#endif
}
}
return s_configPath;
Expand Down Expand Up @@ -227,7 +238,7 @@ QString Config::getServerVersion()

int Config::getMaxFps()
{
int fps = 60;
int fps = 0;
m_settings->beginGroup(GROUP_COMMON);
fps = m_settings->value(COMMON_MAX_FPS_KEY, COMMON_MAX_FPS_DEF).toInt();
m_settings->endGroup();
Expand Down
6 changes: 6 additions & 0 deletions QtScrcpy/util/path.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

class Path {
public:
static const char* GetCurrentPath();
};
7 changes: 7 additions & 0 deletions QtScrcpy/util/path.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "path.h"

#import <Cocoa/Cocoa.h>

const char* Path::GetCurrentPath() {
return [[[NSBundle mainBundle] bundlePath] UTF8String];
}
2 changes: 1 addition & 1 deletion config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WindowTitle=QtScrcpy
# 推送到安卓设备的文件保存路径(必须以/结尾)
PushFilePath=/sdcard/
# 最大fps(仅支持Android 10以上)
MaxFps=60
MaxFps=0
# 是否渲染过期视频帧(跳过过期视频帧意味着更低的延迟)
RenderExpiredFrames=0
# 视频解码方式:-1 自动,0 软解,1 dx硬解,2 opengl硬解
Expand Down

0 comments on commit 6692ee1

Please sign in to comment.