Skip to content

Commit

Permalink
Merge pull request #909 from barry-ran/dev
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
barry-ran committed Feb 25, 2024
2 parents 6692ee1 + ba0883b commit 91a6b4c
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:
jobs:
build:
name: Build
runs-on: macos-10.15
runs-on: macos-11
strategy:
matrix:
qt-ver: [5.15.1]
qt-ver: [5.15.2]
qt-arch-install: [clang_64]
clang-arch: [x64]
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# 矩阵配置 https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
strategy:
matrix:
qt-ver: [5.15.1]
qt-ver: [5.15.2]
qt-arch: [win64_msvc2019_64, win32_msvc2019]
# 配置qt-arch的额外设置msvc-arch,qt-arch-install
include:
Expand Down
3 changes: 3 additions & 0 deletions QtScrcpy/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ int main(int argc, char *argv[])
"following address:");
qInfo() << QString("QtScrcpy %1 <https://github.com/barry-ran/QtScrcpy>").arg(QCoreApplication::applicationVersion());

qInfo() << QObject::tr("If you need more professional screen projection control software, you can try the following software:");
qInfo() << QString(QObject::tr("QuickMirror") + " <https://lrbnfell4p.feishu.cn/docx/QRMhd9nImorAGgxVLlmczxSdnYf>");

int ret = a.exec();
delete g_mainDlg;

Expand Down
Binary file modified QtScrcpy/res/i18n/en_US.qm
Binary file not shown.
8 changes: 8 additions & 0 deletions QtScrcpy/res/i18n/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
<source>This software is completely open source and free. Use it at your own risk. You can download it at the following address:</source>
<translation>This software is completely open source and free. Use it at your own risk. You can download it at the following address:</translation>
</message>
<message>
<source>If you need more professional screen projection control software, you can try the following software:</source>
<translation>If you need more professional screen projection control software, you can try the following software:</translation>
</message>
<message>
<source>QuickMirror</source>
<translation>QuickMirror</translation>
</message>
</context>
<context>
<name>ToolForm</name>
Expand Down
Binary file modified QtScrcpy/res/i18n/zh_CN.qm
Binary file not shown.
8 changes: 8 additions & 0 deletions QtScrcpy/res/i18n/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
<source>This software is completely open source and free. Use it at your own risk. You can download it at the following address:</source>
<translation>本软件完全开源免费,作者不对使用该软件产生的一切后果负责。你可以在以下地址下载:</translation>
</message>
<message>
<source>If you need more professional screen projection control software, you can try the following software:</source>
<translation>如果你需要更加专业的投屏控制软件,可以尝试作者开发的商业版:</translation>
</message>
<message>
<source>QuickMirror</source>
<translation>极限投屏</translation>
</message>
</context>
<context>
<name>ToolForm</name>
Expand Down
20 changes: 16 additions & 4 deletions QtScrcpy/ui/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <QFile>
#include <QFileDialog>
#include <QKeyEvent>
#include <QRandomGenerator>
#include <QTime>
#include <QTimer>

Expand Down Expand Up @@ -272,10 +273,13 @@ void Dialog::slotActivated(QSystemTrayIcon::ActivationReason reason)
void Dialog::closeEvent(QCloseEvent *event)
{
this->hide();
m_hideIcon->showMessage(tr("Notice"),
tr("Hidden here!"),
QSystemTrayIcon::Information,
3000);
if (!Config::getInstance().getTrayMessageShown()) {
Config::getInstance().setTrayMessageShown(true);
m_hideIcon->showMessage(tr("Notice"),
tr("Hidden here!"),
QSystemTrayIcon::Information,
3000);
}
event->ignore();
}

Expand Down Expand Up @@ -317,6 +321,7 @@ void Dialog::on_startServerBtn_clicked()
params.logLevel = Config::getInstance().getLogLevel();
params.codecOptions = Config::getInstance().getCodecOptions();
params.codecName = Config::getInstance().getCodecName();
params.scid = QRandomGenerator::global()->bounded(1, 10000) & 0x7FFFFFFF;

qsc::IDeviceManage::getInstance().connectDevice(params);
}
Expand Down Expand Up @@ -454,8 +459,10 @@ void Dialog::onDeviceConnected(bool success, const QString &serial, const QStrin
videoForm->staysOnTop();
}

#ifndef Q_OS_WIN32
// must be show before updateShowSize
videoForm->show();
#endif
QString name = Config::getInstance().getNickName(serial);
if (name.isEmpty()) {
name = Config::getInstance().getTitle();
Expand All @@ -473,6 +480,11 @@ void Dialog::onDeviceConnected(bool success, const QString &serial, const QStrin
videoForm->setGeometry(rc);
}

#ifdef Q_OS_WIN32
// windows是show太早可以看到resize的过程
QTimer::singleShot(200, videoForm, [videoForm](){videoForm->show();});
#endif

GroupController::instance().addDevice(serial);
}

Expand Down
7 changes: 6 additions & 1 deletion QtScrcpy/ui/videoform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ void VideoForm::switchFullScreen()

bool VideoForm::isHost()
{
if (!m_toolForm) {
return false;
}
return m_toolForm->isHost();
}

Expand Down Expand Up @@ -719,7 +722,9 @@ void VideoForm::showEvent(QShowEvent *event)
{
Q_UNUSED(event)
if (!isFullScreen()) {
showToolForm();
QTimer::singleShot(500, this, [this](){
showToolForm();
});
}
}

Expand Down
22 changes: 21 additions & 1 deletion QtScrcpy/util/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define COMMON_PUSHFILE_DEF "/sdcard/"

#define COMMON_SERVER_VERSION_KEY "ServerVersion"
#define COMMON_SERVER_VERSION_DEF "1.24"
#define COMMON_SERVER_VERSION_DEF "2.1.1"

#define COMMON_SERVER_PATH_KEY "ServerPath"
#define COMMON_SERVER_PATH_DEF "/data/local/tmp/scrcpy-server.jar"
Expand Down Expand Up @@ -93,6 +93,9 @@
#define COMMON_AUTO_UPDATE_DEVICE_KEY "AutoUpdateDevice"
#define COMMON_AUTO_UPDATE_DEVICE_DEF true

#define COMMON_TRAY_MESSAGE_SHOWN_KEY "TrayMessageShown"
#define COMMON_TRAY_MESSAGE_SHOWN_DEF false

// device config
#define SERIAL_WINDOW_RECT_KEY_X "WindowRectX"
#define SERIAL_WINDOW_RECT_KEY_Y "WindowRectY"
Expand Down Expand Up @@ -187,6 +190,23 @@ UserBootConfig Config::getUserBootConfig()
return config;
}

void Config::setTrayMessageShown(bool shown)
{
m_userData->beginGroup(GROUP_COMMON);
m_userData->setValue(COMMON_TRAY_MESSAGE_SHOWN_KEY, shown);
m_userData->endGroup();
m_userData->sync();
}

bool Config::getTrayMessageShown()
{
bool shown;
m_userData->beginGroup(GROUP_COMMON);
shown = m_userData->value(COMMON_TRAY_MESSAGE_SHOWN_KEY, COMMON_TRAY_MESSAGE_SHOWN_DEF).toBool();
m_userData->endGroup();
return shown;
}

void Config::setRect(const QString &serial, const QRect &rc)
{
m_userData->beginGroup(serial);
Expand Down
2 changes: 2 additions & 0 deletions QtScrcpy/util/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class Config : public QObject
// user data:common
void setUserBootConfig(const UserBootConfig &config);
UserBootConfig getUserBootConfig();
void setTrayMessageShown(bool shown);
bool getTrayMessageShown();

// user data:device
void setNickName(const QString &serial, const QString &name);
Expand Down
22 changes: 20 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ QtScrcpy 可以通过 USB / 网络连接Android设备,并进行显示和控制

![linux](screenshot/linux-zh.png)

## 作者开发了更加专业的投屏软件`极限投屏`
极限投屏功能&特点:
- 设备投屏&控制:批量投屏、单个控制、批量控制
- 分组管理
- wifi投屏/OTG投屏
- adb shell快捷指令
- 文件传输、apk安装
- 投屏数量多:在OTG投屏模式,设置分辨率和流畅度为低的情况下,单台电脑可以同时管理500+台手机
- 低延迟:usb投屏1080p延迟在30ms以内,在相同分辨率流畅度情况下,比市面上所有投屏软件延迟都低
- cpu占用率低:纯C++开发,高性能GPU视频渲染
- 高分辨率:可调节,最大支持安卓终端的原生分辨率
- 完美中文输入:支持闲鱼app,支持三星手机
- 免费版最多投屏20台,功能无限制(除了自动重新投屏)
- 极限投屏使用教程:https://lrbnfell4p.feishu.cn/docx/QRMhd9nImorAGgxVLlmczxSdnYf
- 极限投屏qq交流群:822464342
- 极限投屏界面预览:
![quickmirror](docs/image/quickmirror.png)

## 自定义按键映射
可以根据需要,自己编写脚本将键盘按键映射为手机的触摸点击,编写规则在[这里](docs/KeyMapDes_zh.md)

Expand All @@ -48,7 +66,7 @@ QtScrcpy 可以通过 USB / 网络连接Android设备,并进行显示和控制
- 再次按~键切换为正常控制模式
- (对于和平精英等游戏)若想使用方向盘控制载具,记得在载具设置中设置为单摇杆模式

## 群控
## 批量操作
你可以同时控制所有的手机

![gc](docs/image/group-control.gif)
Expand Down Expand Up @@ -176,7 +194,7 @@ Mac OS 平台,你可以直接使用我编译好的可执行程序:
- 屏幕录制
- 截图
- 无线连接
- 多设备连接与群控
- 多设备连接与批量操作
- 全屏显示
- 窗口置顶
- 安装 apk:拖拽apk到显示窗口即可安装
Expand Down
2 changes: 1 addition & 1 deletion config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RenderExpiredFrames=0
# 视频解码方式:-1 自动,0 软解,1 dx硬解,2 opengl硬解
UseDesktopOpenGL=-1
# scrcpy-server的版本号(不要修改)
ServerVersion=1.24
ServerVersion=2.1.1
# scrcpy-server推送到安卓设备的路径
ServerPath=/data/local/tmp/scrcpy-server.jar
# 自定义adb路径,例如D:/android/tools/adb.exe
Expand Down
Binary file added docs/image/quickmirror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 91a6b4c

Please sign in to comment.