Skip to content

Commit

Permalink
feat: 更新scrcpy-server 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
barry committed Feb 25, 2024
1 parent 4e4be93 commit e67ae04
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
9 changes: 9 additions & 0 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 @@ -320,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 @@ -457,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 @@ -476,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
2 changes: 1 addition & 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
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

0 comments on commit e67ae04

Please sign in to comment.