Feature: Add configurable screen-preview quality levels menu
Add a "屏幕预览质量等级 (Screen Preview Quality Levels)" item to the "高级 (Advanced)" menu that opens a dialog to edit the six preset PreviewProfile levels (target encode width and JPEG quality) used by the double-click single-preview and loop-snapshot floating windows. 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 [preview] INI section. ChooseScreenPreviewParams now reads from GetPreviewProfileCfg instead of the hardcoded GetScreenPreviewProfile table, so preview requests sent after a change use the configured parameters. LoadPreviewProfilesFromCfg loads the saved levels at startup, falling back to the built-in defaults. Added en_US/de_DE/zh_TW translations for the new menu and dialog strings. Co-Authored-By: deepseek-v4-pro
This commit is contained in:
1 parent
033ff077ef
commit
32cc7af371
8 files changed
+209
-4
No files matched your search
@@ -44,6 +44,7 @@
|
||||
#include "common/skCrypter.h"
|
||||
#include "common/commands.h"
|
||||
#include "QualityLevelsDlg.h"
|
||||
#include "CPreviewLevelsDlg.h"
|
||||
#include "McpServer.h"
|
||||
#include "McpSettingsDlg.h"
|
||||
#include "common/md5.h"
|
||||
@@ -1015,6 +1016,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
|
||||
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_TOOL_PREVIEW_LEVELS, &CMy2015RemoteDlg::OnPreviewLevels)
|
||||
ON_COMMAND(ID_EXECUTE_TESTRUN, &CMy2015RemoteDlg::OnExecuteTestrun)
|
||||
ON_COMMAND(ID_EXECUTE_GHOST, &CMy2015RemoteDlg::OnExecuteGhost)
|
||||
ON_COMMAND(ID_MASTER_TRAIL, &CMy2015RemoteDlg::OnMasterTrail)
|
||||
@@ -2409,6 +2411,7 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
||||
LoadThumbnailSettingsFromCfg();
|
||||
ApplyThumbnailSettings();
|
||||
LoadQualityProfilesFromCfg();
|
||||
LoadPreviewProfilesFromCfg();
|
||||
m_runNormal = THIS_CFG.GetInt("settings", "RunNormal", 0);
|
||||
|
||||
CMenu* SubMenu = m_MainMenu.GetSubMenu(2);
|
||||
@@ -8797,7 +8800,7 @@ void CMy2015RemoteDlg::OnListSingleClick(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
OpenLoopTip(ctx, anchor);
|
||||
}
|
||||
|
||||
// 屏幕预览参数挑选:复用既有 GetTargetQualityLevel + GetScreenPreviewProfile
|
||||
// 屏幕预览参数挑选:复用 GetTargetQualityLevel + GetPreviewProfileCfg(可配置的 6 档预览参数表)
|
||||
// RTT 阈值表与屏幕共享共用(FRP 模式阈值更宽松);超清档(Ultra/High)+ 4K/超宽屏
|
||||
// 时按 min(screenWidth/4, 1280) 自适应放大,避免高分屏被压成无信息缩略图
|
||||
void CMy2015RemoteDlg::ChooseScreenPreviewParams(context* ctx, WORD& maxWidth, BYTE& jpegQuality) const
|
||||
@@ -8811,7 +8814,7 @@ void CMy2015RemoteDlg::ChooseScreenPreviewParams(context* ctx, WORD& maxWidth, B
|
||||
int rttForLevel = ping > 0 ? ping : 250;
|
||||
|
||||
int level = GetTargetQualityLevel(rttForLevel, m_settings.UsingFRPProxy ? 1 : 0);
|
||||
const PreviewProfile& prof = GetScreenPreviewProfile(level);
|
||||
const PreviewProfile& prof = GetPreviewProfileCfg(level);
|
||||
int base = prof.maxWidth;
|
||||
BYTE q = (BYTE)prof.jpegQuality;
|
||||
|
||||
@@ -9205,6 +9208,58 @@ void CMy2015RemoteDlg::OnQualityLevels()
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 屏幕预览质量等级配置([preview] 节) =====
|
||||
// 6 档 PreviewProfile 的读写入口。缺省值回落到 common/commands.h 的
|
||||
// GetScreenPreviewProfile(),与内置预览参数表一致;用户改过的档位单独落盘到 INI。
|
||||
|
||||
void CMy2015RemoteDlg::LoadPreviewProfilesFromCfg()
|
||||
{
|
||||
// 先整体回落到内置默认,再逐字段覆盖,避免 INI 缺项时读到 0
|
||||
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||
m_PreviewProfiles[i] = GetScreenPreviewProfile(i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||
std::string sec = "preview" + std::to_string(i);
|
||||
PreviewProfile& p = m_PreviewProfiles[i];
|
||||
|
||||
p.maxWidth = THIS_CFG.GetInt("preview", sec + "_maxWidth", p.maxWidth);
|
||||
p.jpegQuality = THIS_CFG.GetInt("preview", sec + "_jpegQuality", p.jpegQuality);
|
||||
|
||||
// Clamp 到安全范围(防 INI 被手工编错)
|
||||
if (p.maxWidth < 64) p.maxWidth = 64;
|
||||
if (p.maxWidth > 2560) p.maxWidth = 2560;
|
||||
if (p.jpegQuality < 1) p.jpegQuality = 1;
|
||||
if (p.jpegQuality > 100) p.jpegQuality = 100;
|
||||
}
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::SavePreviewProfilesToCfg() const
|
||||
{
|
||||
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||
std::string sec = "preview" + std::to_string(i);
|
||||
const PreviewProfile& p = m_PreviewProfiles[i];
|
||||
THIS_CFG.SetInt("preview", sec + "_maxWidth", p.maxWidth);
|
||||
THIS_CFG.SetInt("preview", sec + "_jpegQuality", p.jpegQuality);
|
||||
}
|
||||
}
|
||||
|
||||
const PreviewProfile& CMy2015RemoteDlg::GetPreviewProfileCfg(int level) const
|
||||
{
|
||||
if (level < 0 || level >= QUALITY_COUNT)
|
||||
return GetScreenPreviewProfile(level); // 越界:与 common 默认表同源兜底
|
||||
return m_PreviewProfiles[level];
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::OnPreviewLevels()
|
||||
{
|
||||
CPreviewLevelsDlg dlg(m_PreviewProfiles, this);
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
SavePreviewProfilesToCfg();
|
||||
MessageBoxL("预览质量等级已保存,下次发送预览时生效。", "提示", MB_ICONINFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::ApplyThumbnailSettings()
|
||||
{
|
||||
// 任何已缓存的 HBITMAP 都是按"旧 ThumbWidth"渲染的,尺寸不再可信 —— 一律清空。
|
||||
|
||||
Reference in new issue
Block a user