Feature: Add configurable remote-desktop quality levels menu
Add an "高级 (Advanced)" menu after "其他 (Other)" whose "远程桌面质量等级 (Remote Desktop Quality Levels)" item opens a dialog to edit the six preset QualityProfile levels (max FPS, max width, codec algorithm, bitrate). The dialog edits a working copy in a full grid with per-field validation and a restore-defaults button; on OK it persists the values to the [quality] INI section. The server stays authoritative: LoadQualityProfilesFromCfg loads the saved levels at startup (falling back to GetQualityProfile defaults), and ScreenSpyDlg now sends CMD_QUALITY_PROFILES from GetQualityProfileCfg so new remote-desktop sessions transmit with the configured parameters. Added en_US/de_DE/zh_TW translations for the menu and dialog strings. Co-Authored-By: deepseek-v4-pro
This commit is contained in:
1 parent
0416dadbba
commit
033ff077ef
9 files changed
+294
-3
No files matched your search
@@ -43,6 +43,7 @@
|
||||
#include <sstream>
|
||||
#include "common/skCrypter.h"
|
||||
#include "common/commands.h"
|
||||
#include "QualityLevelsDlg.h"
|
||||
#include "McpServer.h"
|
||||
#include "McpSettingsDlg.h"
|
||||
#include "common/md5.h"
|
||||
@@ -1013,6 +1014,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
|
||||
ON_COMMAND(ID_TOOL_IMPORT_LICENSE, &CMy2015RemoteDlg::OnToolImportLicense)
|
||||
ON_COMMAND(ID_TOOL_V2_PRIVATEKEY, &CMy2015RemoteDlg::OnToolV2PrivateKey)
|
||||
ON_COMMAND(ID_MENU_NOTIFY_SETTINGS, &CMy2015RemoteDlg::OnMenuNotifySettings)
|
||||
ON_COMMAND(ID_TOOL_QUALITY_LEVELS, &CMy2015RemoteDlg::OnQualityLevels)
|
||||
ON_COMMAND(ID_EXECUTE_TESTRUN, &CMy2015RemoteDlg::OnExecuteTestrun)
|
||||
ON_COMMAND(ID_EXECUTE_GHOST, &CMy2015RemoteDlg::OnExecuteGhost)
|
||||
ON_COMMAND(ID_MASTER_TRAIL, &CMy2015RemoteDlg::OnMasterTrail)
|
||||
@@ -2406,6 +2408,7 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
||||
// 这里读完 INI 后再 Apply 一次纠正过来。
|
||||
LoadThumbnailSettingsFromCfg();
|
||||
ApplyThumbnailSettings();
|
||||
LoadQualityProfilesFromCfg();
|
||||
m_runNormal = THIS_CFG.GetInt("settings", "RunNormal", 0);
|
||||
|
||||
CMenu* SubMenu = m_MainMenu.GetSubMenu(2);
|
||||
@@ -9142,6 +9145,66 @@ void CMy2015RemoteDlg::SaveThumbnailSettingsToCfg() const
|
||||
THIS_CFG.SetInt("thumbnail", "JpegQuality", m_ThumbnailCfg.JpegQuality);
|
||||
}
|
||||
|
||||
// ===== 远程桌面质量等级配置([quality] 节) =====
|
||||
// 6 档 QualityProfile 的读写与下发入口。缺省值回落到 common/commands.h 的
|
||||
// GetQualityProfile(),与客户端默认表一致;用户改过的档位单独落盘到 INI。
|
||||
|
||||
void CMy2015RemoteDlg::LoadQualityProfilesFromCfg()
|
||||
{
|
||||
// 先整体回落到内置默认,再逐字段覆盖,避免 INI 缺项时读到 0
|
||||
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||
m_QualityProfiles[i] = GetQualityProfile(i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||
std::string sec = "profile" + std::to_string(i);
|
||||
QualityProfile& p = m_QualityProfiles[i];
|
||||
|
||||
p.maxFPS = THIS_CFG.GetInt("quality", sec + "_maxFPS", p.maxFPS);
|
||||
p.maxWidth = THIS_CFG.GetInt("quality", sec + "_maxWidth", p.maxWidth);
|
||||
p.algorithm = THIS_CFG.GetInt("quality", sec + "_algorithm", p.algorithm);
|
||||
p.bitRate = THIS_CFG.GetInt("quality", sec + "_bitRate", p.bitRate);
|
||||
|
||||
// Clamp 到安全范围(防 INI 被手工编错)
|
||||
if (p.maxFPS < 1) p.maxFPS = 1;
|
||||
if (p.maxFPS > 60) p.maxFPS = 60;
|
||||
if (p.maxWidth < 0) p.maxWidth = 0;
|
||||
if (p.maxWidth > 8192) p.maxWidth = 8192;
|
||||
if (p.algorithm < ALGORITHM_GRAY || p.algorithm > ALGORITHM_RGB565)
|
||||
p.algorithm = ALGORITHM_H264;
|
||||
if (p.bitRate < 0) p.bitRate = 0;
|
||||
if (p.bitRate > 50000) p.bitRate = 50000;
|
||||
}
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::SaveQualityProfilesToCfg() const
|
||||
{
|
||||
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||
std::string sec = "profile" + std::to_string(i);
|
||||
const QualityProfile& p = m_QualityProfiles[i];
|
||||
THIS_CFG.SetInt("quality", sec + "_maxFPS", p.maxFPS);
|
||||
THIS_CFG.SetInt("quality", sec + "_maxWidth", p.maxWidth);
|
||||
THIS_CFG.SetInt("quality", sec + "_algorithm", p.algorithm);
|
||||
THIS_CFG.SetInt("quality", sec + "_bitRate", p.bitRate);
|
||||
}
|
||||
}
|
||||
|
||||
const QualityProfile& CMy2015RemoteDlg::GetQualityProfileCfg(int level) const
|
||||
{
|
||||
if (level < 0 || level >= QUALITY_COUNT)
|
||||
return GetQualityProfile(level); // 越界:与 common 默认表同源兜底
|
||||
return m_QualityProfiles[level];
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::OnQualityLevels()
|
||||
{
|
||||
CQualityLevelsDlg dlg(m_QualityProfiles, this);
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
SaveQualityProfilesToCfg();
|
||||
MessageBoxL("质量等级已保存,下次打开远程桌面时生效。", "提示", MB_ICONINFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::ApplyThumbnailSettings()
|
||||
{
|
||||
// 任何已缓存的 HBITMAP 都是按"旧 ThumbWidth"渲染的,尺寸不再可信 —— 一律清空。
|
||||
|
||||
Reference in new issue
Block a user