feat: update config

This commit is contained in:
rankun 2020-01-16 17:54:42 +08:00
parent c96e3ed9dd
commit 3e725e1675
8 changed files with 60 additions and 13 deletions

View file

@ -10,6 +10,7 @@
#include "stream.h"
#include "videoform.h"
#include "controller.h"
#include "config.h"
Device::Device(DeviceParams params, QObject *parent)
: QObject(parent)
@ -27,8 +28,7 @@ Device::Device(DeviceParams params, QObject *parent)
m_decoder = new Decoder(m_vb, this);
m_fileHandler = new FileHandler(this);
m_controller = new Controller(params.gameScript, this);
//m_videoForm = new VideoForm(false);
m_videoForm = new VideoForm();
m_videoForm = new VideoForm(Config::getInstance().getSkin());
m_videoForm->setSerial(m_params.serial);
if (m_controller) {
m_videoForm->setController(m_controller);

View file

@ -153,7 +153,7 @@ void Dialog::on_startServerBtn_clicked()
params.maxSize = videoSize;
params.bitRate = bitRate;
// on devices with Android >= 10, the capture frame rate can be limited
params.maxFps = 60;
params.maxFps = Config::getInstance().getMaxFps();
params.recordFileName = absFilePath;
params.closeScreen = ui->closeScreenCheck->isChecked();
params.useReverse = ui->useReverseCheck->isChecked();

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<width>513</width>
<height>637</height>
</rect>
</property>
@ -169,7 +169,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>240</height>
<height>200</height>
</size>
</property>
<property name="focusPolicy">

View file

@ -18,9 +18,7 @@ void installTranslator();
int main(int argc, char *argv[])
{
//QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
//QApplication::setAttribute(Qt::AA_UseOpenGLES);
//QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
g_oldMessageHandler = qInstallMessageHandler(myMessageOutput);
Stream::init();
@ -64,6 +62,15 @@ int main(int argc, char *argv[])
file.close();
}
int opengl = Config::getInstance().getDesktopOpenGL();
if (0 == opengl) {
QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
} else if (1 == opengl){
QApplication::setAttribute(Qt::AA_UseOpenGLES);
} else if (2 == opengl) {
QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
}
g_mainDlg = new Dialog;
g_mainDlg->setWindowTitle(Config::getInstance().getTitle());
g_mainDlg->show();

View file

@ -15,6 +15,14 @@
#define COMMON_SERVER_VERSION_KEY "ServerVersion"
#define COMMON_SERVER_VERSION_DEF "1.12.1"
#define COMMON_MAX_FPS_KEY "MaxFps"
#define COMMON_MAX_FPS_DEF 60
#define COMMON_DESKTOP_OPENGL_KEY "UseDesktopOpenGL"
#define COMMON_DESKTOP_OPENGL_DEF -1
#define COMMON_SKIN_KEY "UseSkin"
#define COMMON_SKIN_DEF 1
QString Config::s_configPath = "";
@ -67,6 +75,33 @@ QString Config::getServerVersion()
return server;
}
int Config::getMaxFps()
{
int fps = 60;
m_settings->beginGroup(GROUP_COMMON);
fps = m_settings->value(COMMON_MAX_FPS_KEY, COMMON_MAX_FPS_DEF).toInt();
m_settings->endGroup();
return fps;
}
int Config::getDesktopOpenGL()
{
int opengl = 0;
m_settings->beginGroup(GROUP_COMMON);
opengl = m_settings->value(COMMON_DESKTOP_OPENGL_KEY, COMMON_DESKTOP_OPENGL_DEF).toInt();
m_settings->endGroup();
return opengl;
}
int Config::getSkin()
{
int skin = 1;
m_settings->beginGroup(GROUP_COMMON);
skin = m_settings->value(COMMON_SKIN_KEY, COMMON_SKIN_DEF).toInt();
m_settings->endGroup();
return skin;
}
QString Config::getTitle()
{
QString title;

View file

@ -14,6 +14,9 @@ public:
QString getRecordPath();
void setRecordPath(const QString& path);
QString getServerVersion();
int getMaxFps();
int getDesktopOpenGL();
int getSkin();
private:
explicit Config(QObject *parent = nullptr);

View file

@ -1,4 +1,7 @@
[common]
WindowTitle=abc
RecordPath=C:/Users/bytedance/Desktop
WindowTitle=QtScrcpy
RecordPath=
MaxFps=60
ServerVersion=1.12.1
UseSkin=1
UseDesktopOpenGL=-1

View file

@ -5,6 +5,7 @@
- 中文输入server需要改为apk作为一个输入法暂不实现或者有其他方式案件注入方式例如搜狗手机输入法可以监听当前注入
- [跳过帧改为动态配置,而不是静态编译](https://github.com/Genymobile/scrcpy/commit/ebccb9f6cc111e8acfbe10d656cac5c1f1b744a0)
- [单独线程统计帧率](https://github.com/Genymobile/scrcpy/commit/e2a272bf99ecf48fcb050177113f903b3fb323c4)
- text转换 https://github.com/Genymobile/scrcpy/commit/c916af0984f72a60301d13fa8ef9a85112f54202?tdsourcetag=s_pctim_aiomsg
- ui提供show touch设置
## 中优先级
@ -12,11 +13,9 @@
- 自动打包脚本
- 脚本
- 群控
- 配置文件
- 软硬解配置,去皮肤配置
- 窗口可改变大小
- 竖屏全屏不拉伸画面
- 分辨率码率可自定义
- opengles 3.0
## 高优先级
- linux打包以及版本号