Skip to content

Commit fbae27b

Browse files
authored
Merge pull request #696 from barry-ran/dev
merge dev
2 parents 97975ee + 06ce462 commit fbae27b

26 files changed

+559
-360
lines changed

.github/workflows/ubuntu.yml

+40-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Ubuntu
2-
# Qt官方没有linux平台的x86包
32
on:
43
push:
54
paths:
@@ -19,35 +18,64 @@ jobs:
1918
strategy:
2019
matrix:
2120
os: [ubuntu-22.04]
22-
qt-ver: [5.15.1]
21+
qt-ver: [5.15.2]
2322
qt-arch-install: [gcc_64]
2423
gcc-arch: [x64]
2524
env:
2625
target-name: QtScrcpy
2726
qt-install-path: ${{ github.workspace }}/${{ matrix.qt-ver }}
2827
plantform-des: ubuntu
2928
steps:
30-
- name: Cache Qt
31-
id: cache-qt
32-
uses: actions/cache@v1
33-
with:
34-
path: ${{ env.qt-install-path }}/${{ matrix.qt-arch-install }}
35-
key: ${{ runner.os }}/${{ matrix.qt-ver }}/${{ matrix.qt-arch-install }}
3629
- name: Install Qt
3730
uses: jurplel/[email protected]
3831
with:
3932
version: ${{ matrix.qt-ver }}
4033
cached: ${{ steps.cache-qt.outputs.cache-hit }}
41-
- name: Ubuntu install GL library
34+
- name: Cache Qt
35+
id: cache-qt
36+
uses: actions/[email protected]
37+
with:
38+
path: ${{ env.qt-install-path }}/${{ matrix.qt-arch-install }}
39+
key: ${{ runner.os }}/${{ matrix.qt-ver }}/${{ matrix.qt-arch-install }}
40+
- name: Install GL library
4241
run: sudo apt-get install -y libglew-dev libglfw3-dev
4342
- uses: actions/checkout@v2
4443
with:
4544
fetch-depth: 0
4645
submodules: 'true'
4746
ssh-key: ${{ secrets.BOT_SSH_KEY }}
48-
- name: Build Ubuntu
47+
- name: Build RelWithDebInfo
48+
env:
49+
ENV_QT_PATH: ${{ env.qt-install-path }}
50+
run: |
51+
ci/linux/build_for_linux.sh "RelWithDebInfo"
52+
- name: Upload RelWithDebInfo
53+
uses: actions/[email protected]
54+
with:
55+
name: QtScrcpy-${{ matrix.os }}-${{ matrix.qt-arch-install }}-RelWithDebInfo
56+
path: output/x64/RelWithDebInfo/*
57+
- name: Build Release
4958
env:
5059
ENV_QT_PATH: ${{ env.qt-install-path }}
5160
run: |
52-
python ci/generate-version.py
53-
ci/linux/build_for_ubuntu.sh RelWithDebInfo
61+
ci/linux/build_for_linux.sh "Release"
62+
- name: Upload Release
63+
uses: actions/[email protected]
64+
with:
65+
name: QtScrcpy-${{ matrix.os }}-${{ matrix.qt-arch-install }}-Release
66+
path: output/x64/Release/*
67+
- name: Install the zip utility
68+
run: |
69+
sudo apt install zip -y
70+
- name: Zip the Artifacts
71+
run: |
72+
zip -r QtScrcpy-${{ matrix.os }}-${{ matrix.qt-arch-install }}.zip output/x64/Release
73+
- name: Upload to Releases
74+
if: startsWith(github.ref, 'refs/tags/')
75+
uses: svenstaro/[email protected]
76+
with:
77+
file: QtScrcpy-${{ matrix.os }}-${{ matrix.qt-arch-install }}.zip
78+
asset_name: QtScrcpy-${{ matrix.os }}-${{ matrix.qt-arch-install }}.zip
79+
repo_token: ${{ secrets.GITHUB_TOKEN }}
80+
tag: ${{ github.ref }}
81+
overwrite: true

QtScrcpy/ui/dialog.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ void Dialog::on_startServerBtn_clicked()
298298
params.renderExpiredFrames = Config::getInstance().getRenderExpiredFrames();
299299
params.lockVideoOrientation = ui->lockOrientationBox->currentIndex() - 1;
300300
params.stayAwake = ui->stayAwakeCheck->isChecked();
301+
params.recordFile = ui->recordScreenCheck->isChecked();
301302
params.recordPath = ui->recordPathEdt->text().trimmed();
302303
params.recordFileFormat = ui->formatBox->currentText().trimmed();
303304
params.serverLocalPath = getServerPath();

QtScrcpy/ui/videoform.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ void VideoForm::switchFullScreen()
467467
}
468468

469469
showNormal();
470+
// back to normal size.
471+
resize(m_normalSize);
470472
// fullscreen window will move (0,0). qt bug?
471473
move(m_fullScreenBeforePos);
472474

@@ -487,6 +489,9 @@ void VideoForm::switchFullScreen()
487489
ui->keepRatioWidget->setWidthHeightRatio(-1.0f);
488490
}
489491

492+
// record current size before fullscreen, it will be used to rollback size after exit fullscreen.
493+
m_normalSize = size();
494+
490495
m_fullScreenBeforePos = pos();
491496
// 这种临时增加标题栏再全屏的方案会导致收不到mousemove事件,导致setmousetrack失效
492497
// mac fullscreen must show title bar

QtScrcpy/ui/videoform.h

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class VideoForm : public QWidget, public qsc::DeviceObserver
7979

8080
//inside member
8181
QSize m_frameSize;
82+
QSize m_normalSize;
8283
QPoint m_dragPosition;
8384
float m_widthHeightRatio = 0.5f;
8485
bool m_skin = true;

README.md

+58-47
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
![license](https://img.shields.io/badge/license-Apache2.0-blue.svg)
99
![release](https://img.shields.io/github/v/release/barry-ran/QtScrcpy.svg)
1010

11-
[中文介绍](README_zh.md)
11+
[中文用户?点我查看中文介绍](README_zh.md)
1212

13-
QtScrcpy connects to Android devices via USB (or via TCP/IP) for display and control. It does NOT require root privileges.
13+
QtScrcpy supports displaying and controlling Android devices via USB or over network. It does NOT require root privileges.
1414

1515
It supports three major platforms: GNU/Linux, Windows and macOS.
1616

1717
It focuses on:
1818

19-
- **lightness** (native, displays only the device screen)
20-
- **performance** (30~60fps)
19+
- **lightness** (displays only the device screen)
20+
- **performance** (30~60 fps)
2121
- **quality** (1920×1080 or above)
2222
- **low latency** ([35~70ms][lowlatency])
23-
- **low startup time** (~1 second to display the first image)
24-
- **non-intrusiveness** (nothing is left installed on the device)
23+
- **low startup time** (only about 1 second to display the first frame)
24+
- **non-intrusiveness** (nothing will be installed on the device)
2525

2626
[lowlatency]: https://github.com/Genymobile/scrcpy/pull/646
2727

@@ -31,37 +31,37 @@ It focuses on:
3131

3232
![linux](screenshot/linux-en.png)
3333

34-
## Customized key mapping
35-
You can write your script to map keyboard and mouse actions to touches and clicks of the mobile phone according to your needs. [Here](docs/KeyMapDes.md) are the rules.
34+
## Mapping Keys
35+
You can write your script to map keyboard and mouse actions to touches and clicks of the mobile phone according to your needs. [Here](docs/KeyMapDes.md) are the script writing rules.
3636

37-
A script for "PUBG mobile" and TikTok mapping is provided by default. Once enabled, you can play the game with your keyboard and mouse as the PC version. or you can use up/down/left/right direction keys to simulate up/down/left/right sliding. You can also write your mapping files for other games according to [the writing rules](docs/KeyMapDes.md). The default key mapping is as follows:
37+
Script for TikTok and some other games are provided by default. Once enabled, you can play the game with your keyboard and mouse. The default key mapping for PUBG Mobile is as follows:
3838

3939
![game](screenshot/game.jpg)
4040

41-
[Here is a video demonstration of playing "PUBG mobile"](http://mp.weixin.qq.com/mp/video?__biz=MzU1NTg5MjYyNw==&mid=100000015&sn=3e301fdc5a364bd16d6207fa674bc8b3&vid=wxv_968792362971430913&idx=1&vidsn=eec329cc13c3e24c187dc9b4d5eb8760&fromid=1&scene=20&xtrack=1&clicktime=1567346543&sessionid=1567346375&subscene=92&ascene=0&fasttmpl_type=0&fasttmpl_fullversion=4730859-zh_CN-zip&fasttmpl_flag=0&realreporttime=1567346543910#wechat_redirect)
41+
[Here is a video demonstration playing PUBG Mobile.](http://mp.weixin.qq.com/mp/video?__biz=MzU1NTg5MjYyNw==&mid=100000015&sn=3e301fdc5a364bd16d6207fa674bc8b3&vid=wxv_968792362971430913)
4242

43-
Here is the instruction for adding new customized mapping files.
43+
Instruction for adding new customized mapping files.
4444

4545
- Write a customized script and put it in the `keymap` directory
46-
- Click `refresh script` to check whether it can be found
46+
- Click `refresh script` to show it
4747
- Select your script
48-
- Connect your phone, start service and click `apply`
49-
- Press `~` key (left side of the number key 1) to switch to the custom mapping mode (It can be changed in the script as `switchkey`)
48+
- Connect to your phone, start service and click `apply`
49+
- Press `~` key (the SwitchKey in the key map script) to switch to custom mapping mode
5050
- Press the ~ key again to switch back to normal mode
51-
- (For PUBG and similar games) If you want to drive cars with WASD, you need to check the `single rocker mode` in the game setting.
51+
- (For games such as PUBG Mobile) If you want to move vehicles with the STEER_WHEEL keys, you need to set the move mode to `single rocker mode`.
5252

5353
## Group control
5454
You can control all your phones at the same time.
5555

56-
![](docs/image/group-control.gif)
56+
![group-control-demo](docs/image/group-control.gif)
5757

5858
## Thanks
5959

60-
QtScrcpy is based on [Genymobile's](https://github.com/Genymobile) [scrcpy](https://github.com/Genymobile/scrcpy) project. Thanks
60+
QtScrcpy is based on [Genymobile](https://github.com/Genymobile)'s [scrcpy](https://github.com/Genymobile/scrcpy) project. Thanks a lot!
6161

6262
The difference between QtScrcpy and the original scrcpy is as follows:
6363

64-
keys|scrcpy|QtScrcpy
64+
key points|scrcpy|QtScrcpy
6565
--|:--:|:--:
6666
ui|sdl|qt
6767
video encode|ffmpeg|ffmpeg
@@ -104,22 +104,29 @@ Make sure you have enabled [ADB debugging][enable-adb] on your device(s).
104104
[github-download]: https://github.com/barry-ran/QtScrcpy/releases
105105

106106
### Windows
107-
For Windows, for simplicity, prebuilt archives with all the dependencies (including ADB) are available:
107+
On Windows, for simplicity, prebuilt archives with all the dependencies (including ADB) are available at Releases:
108108

109109
- [`QtScrcpy`][github-download]
110110

111-
or you can [build it by yourself](#Build)
111+
or you can [build it yourself](#Build)
112112

113113
### Mac OS
114-
For Mac OS, for simplicity, prebuilt archives with all the dependencies (including ADB) are available:
114+
On Mac OS, for simplicity, prebuilt archives with all the dependencies (including ADB) are available at Releases:
115115

116116
- [`QtScrcpy`][github-download]
117117

118-
or you can [build it by yourself](#Build)
118+
or you can [build it yourself](#Build)
119119

120120
### Linux
121-
you can [build it by yourself](#Build)(just ubuntu test)
121+
For Arch Linux Users, you can use AUR to install: `yay -Syu qtscrcpy` (may be outdated; maintainer: [yochananmarqos](https://aur.archlinux.org/account/yochananmarqos))
122122

123+
For users in other distros, you can use the prebuilt archives from Releases:
124+
125+
- [`QtScrcpy`][github-download]
126+
127+
or you can get it at [GitHub Actions](https://github.com/UjhhgtgTeams/QtScrcpy/actions/workflows/ubuntu.yml), in branch `dev` and download the latest artifact.
128+
129+
or you can [build it yourself](#Build) (not recommended, get it in Actions if you can)
123130

124131
## Run
125132
Connect to your Android device on your computer, then run the program and click `USB connect` or `WiFi connect`
@@ -176,10 +183,9 @@ Note: it is not necessary to keep your Android device connected via USB after yo
176183
It is possible to synchronize clipboards between the computer and the device, in
177184
both directions:
178185

179-
- `Ctrl`+`c` copies the device clipboard to the computer clipboard;
180-
- `Ctrl`+`Shift`+`v` copies the computer clipboard to the device clipboard;
181-
- `Ctrl`+`v` _pastes_ the computer clipboard as a sequence of text events (but
182-
breaks non-ASCII characters).
186+
- `Ctrl + c` copies the device clipboard to the computer clipboard;
187+
- `Ctrl + Shift + v` copies the computer clipboard to the device clipboard;
188+
- `Ctrl + v` _pastes_ the computer clipboard as a sequence of text events (non-ASCII characters does not yet work).
183189
- Group control
184190
- Sync device speaker sound to the computer (based on [sndcpy](https://github.com/rom1v/sndcpy), Android 10+ only)
185191

@@ -222,39 +228,44 @@ _³Only on Android >= 7._
222228
[DEVELOP](docs/DEVELOP.md)
223229

224230
Everyone is welcome to maintain this project and contribute your own code, but please follow these requirements:
225-
1. pr please mention the dev branch, not the master branch
226-
2. Please rebase dev before mentioning pr
227-
3. pr please submit on the principle of a small number of times (a small function point is recommended to mention a pr)
228-
4. Please keep the code style consistent with the existing style
231+
1. Please open PRs to the dev branch instead of the master branch
232+
2. Please rebase the original project before opening PRs
233+
3. Please submit PRs on the principle of "small amounts, many times" (one PR for a change is recommended)
234+
4. Please keep the code style consistent with the existing style.
229235

230236
## Why develop QtScrcpy?
231237
There are several reasons listed below according to importance (high to low).
232-
1. In the process of learning Qt, I need a real project to try
233-
2. I have some background skills in audio and video and I am interested in them
238+
1. In the process of learning Qt, I need a real project to try.
239+
2. I have some background skills in audio and video and I am interested in them.
234240
3. I have some Android development skills. But I have used it for a long time. I want to consolidate it.
235-
4. I found scrcpy and decided to re-make it with the new technology stack (C++ + Qt + Opengl + FFmpeg)
241+
4. I found scrcpy and decided to re-make it with the new technology stack (C++ + Qt + Opengl + FFmpeg).
236242

237243

238244
## Build
239245
All the dependencies are provided and it is easy to compile.
240246

241-
### PC client
242-
1. Set up the Qt development environment on the target platform.
243-
Qt version>=5.12 (use MSVC 2019 on Windows)
244-
2. Clone the project (git clone --recursive [email protected]:barry-ran/QtScrcpy.git)
245-
3. Open the project root directory `CMakeLists.txt` with QtCreator
246-
4. Compile and run
247-
248-
### Android (If you do not have special requirements, you can directly use the built-in scrcpy-server.jar)
249-
250-
1. Set up an Android development environment on the target platform
247+
### QtScrcpy
248+
#### Non-Arch Linux Users
249+
1. Set up the Qt development environment with the official Qt installer or third-party tools such as [aqt](https://github.com/miurahr/aqtinstall) on the target platform.
250+
Qt version bigger than 5.12 is required. (use MSVC 2019 on Windows)
251+
2. Clone the project with `git clone --recurse-submodules https://barry-ran/QtScrcpy.git`
252+
3. For Windows, open CMakeLists.txt with QtCreator and compile Release
253+
4. For Linux, directly run `./ci/linux/build_for_linux.sh "Release"`
254+
Note: compiled artifacts are located at `output/x64/Release`
255+
256+
#### Arch Linux Users
257+
1. Install packages: `base-devel cmake qt5-base qt5-multimedia qt5-x11extras` (`qtcreator` is recommended)
258+
2. Clone the project with `git clone --recurse-submodules https://barry-ran/QtScrcpy.git`
259+
3. Run `./ci/linux/build_for_linux.sh "Release"`
260+
261+
### Scrcpy-Server
262+
1. Set up Android development environment on the target platform
251263
2. Open server project in project root with Android Studio
252-
3. The first time you open it, if you do not have the corresponding version of Gradle, you will be prompted to find Gradle, whether to upgrade Gradle or create it. Select Cancel. After canceling, you will be prompted to select the location of the existing Gradle. You can also cancel it (it will download automatically).
253-
4. Edit the code as needed, but of course, you don’t need to.
264+
3. The first time you open it, if you do not have the corresponding version of Gradle, you will be prompted to find Gradle, whether to upgrade Gradle or create it. Select Cancel. After cancelling, you will be prompted to select the location of existing Gradle. Cancel it too and it will download automatically.
254265
4. After compiling the apk, rename it to scrcpy-server and replace QtScrcpy/QtScrcpyCore/src/third_party/scrcpy-server.
255266

256267
## Licence
257-
Since it is based on scrcpy, respect its Licence
268+
Since it is based on scrcpy, it uses the same license as scrcpy
258269

259270
Copyright (C) 2025 Rankun
260271

0 commit comments

Comments
 (0)