diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index 3c03398..6b502ac 100644 Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index e85e60f..a9c5a58 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -5577,7 +5577,21 @@ std::string floatToString(float f) void CMy2015RemoteDlg::OnOnlineDelete() { // TODO: 在此添加命令处理程序代码 - if (IDYES != MessageBoxL(_T("确定删除选定的被控计算机吗?"), _T("提示"), MB_ICONQUESTION | MB_YESNO)) + // 确认框里带上是哪几台主机:原来只说“选定的被控计算机”,多选时无从核对。 + EnterCriticalSection(&m_cs); + std::vector preview = ResolveCommandTargets(); + const int targetCount = (int)preview.size(); + CString targetList = DescribeTargetHosts(preview, 5); + LeaveCriticalSection(&m_cs); + + if (targetCount == 0) return; // 没选中主机时不弹空确认框 + + CString msg; + msg.Format(_TRF("确定要断开并删除以下 %d 台主机吗?"), targetCount); + msg += _T("\r\n\r\n"); + msg += targetList; + + if (MessageBox(msg, _TR("提示"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) != IDYES) return; // 确认框是模态的,期间列表可能已经重排;目标在锁内一次性锁定,后面发指令和 @@ -8023,6 +8037,37 @@ std::vector CMy2015RemoteDlg::ResolveCommandTargets() return targets; } +// 危险操作确认框里的目标清单。原来关机/重启/注销/删除/卸载的确认框只说“选定的主机”, +// 用户既看不出要点的是哪个操作,也看不出会作用在哪几台机器上 —— 多选时尤其危险。 +// 这里统一把「备注(没有则计算机名)(IP)」拼出来,超过 maxShow 台只列前几台,总数由 +// 调用方的正文交代,末尾补一行省略号避免让人误以为只影响列出的这几台。 +CString CMy2015RemoteDlg::DescribeTargetHosts(const std::vector& targets, int maxShow) +{ + CString list; + const int total = (int)targets.size(); + const int show = (total < maxShow) ? total : maxShow; + for (int i = 0; i < show; i++) { + context* ctx = targets[i]; + if (!ctx) continue; + CString name = m_ClientMap->GetClientMapData(ctx->GetClientID(), MAP_NOTE); + if (name.IsEmpty()) name = ctx->GetClientData(ONLINELIST_COMPUTER_NAME); + CString ip = ctx->GetClientData(ONLINELIST_IP); + if (name.IsEmpty()) name = ip; + CString line; + if (ip.IsEmpty() || name == ip) { + line = name; + } else { + line.Format(_T("%s (%s)"), name.GetString(), ip.GetString()); + } + if (!list.IsEmpty()) list += _T("\r\n"); + list += _T(" ") + line; + } + if (total > show) { + list += _T("\r\n ..."); + } + return list; +} + // 从 m_HostList 中移除 context 并更新索引映射。 // // 重要:MarkDeviceOffline / m_ActiveWndW.erase 等"主机下线"副作用必须**只在 @@ -12315,7 +12360,21 @@ void CMy2015RemoteDlg::OnToolRcedit() void CMy2015RemoteDlg::OnOnlineUninstall() { - if (IDYES != MessageBoxL(_T("确定卸载选定的被控程序吗?"), _T("提示"), MB_ICONQUESTION | MB_YESNO)) + // 确认框里带上是哪几台主机:原来只说“选定的被控程序”,多选时无从核对。 + EnterCriticalSection(&m_cs); + std::vector preview = ResolveCommandTargets(); + const int targetCount = (int)preview.size(); + CString targetList = DescribeTargetHosts(preview, 5); + LeaveCriticalSection(&m_cs); + + if (targetCount == 0) return; // 没选中主机时不弹空确认框 + + CString msg; + msg.Format(_TRF("确定要卸载以下 %d 台主机上的被控程序吗?"), targetCount); + msg += _T("\r\n\r\n"); + msg += targetList; + + if (MessageBox(msg, _TR("提示"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) != IDYES) return; // 确认框是模态的,期间列表可能已经重排;目标在锁内一次性锁定,后面发指令和 @@ -12394,9 +12453,55 @@ void CMy2015RemoteDlg::OnOnlinePrivateScreen() SendSelectedCommand(buffer.data(), (ULONG)buffer.size()); } +// 主机是否命中筛选关键字。匹配的列与原来搜索栏“查找”用的列保持一致: +// IP / 地理位置 / 计算机名或备注 / 操作系统 / 版本。改这里要同步改 UI 提示。 +bool CMy2015RemoteDlg::HostMatchesFilter(context* ctx, const CString& lowerKey) +{ + if (!ctx) return false; + static const int cols[] = { + ONLINELIST_IP, ONLINELIST_LOCATION, ONLINELIST_COMPUTER_NAME, + ONLINELIST_OS, ONLINELIST_VERSION + }; + for (int col : cols) { + CString text; + if (col == ONLINELIST_COMPUTER_NAME) { + // 备注优先、没备注用计算机名 —— 与列表该列显示的口径一致 + text = m_ClientMap->GetClientMapData(ctx->GetClientID(), MAP_NOTE); + if (text.IsEmpty()) text = ctx->GetClientData(col); + } else { + text = ctx->GetClientData(col); + } + // 地理位置列统一按 UTF-8 存储(见 AddList),而输入是 CP_ACP, + // 转回 CP_ACP 再比对,否则按中文位置筛选会因编码不一致而失配。 + if (col == ONLINELIST_LOCATION) { + text = CString(Utf8ToAnsi(std::string(text.GetString())).c_str()); + } + text.MakeLower(); + if (text.Find(lowerKey) >= 0) return true; + } + return false; +} + +void CMy2015RemoteDlg::SetHostFilter(const CString& text) +{ + CString key = text; + key.Trim(); + if (key == m_strHostFilter) return; // 没变化就不重排列表,避免闪一下 + m_strHostFilter = key; + + EnterCriticalSection(&m_cs); + LoadListData(m_selectedGroup); + LeaveCriticalSection(&m_cs); +} + void CMy2015RemoteDlg::RebuildFilteredIndices() { m_FilteredIndices.clear(); + + CString key = m_strHostFilter; + key.MakeLower(); + const bool filtering = !key.IsEmpty(); + for (size_t i = 0; i < m_HostList.size(); ++i) { context* ctx = m_HostList[i]; if (!ctx) continue; @@ -12404,6 +12509,8 @@ void CMy2015RemoteDlg::RebuildFilteredIndices() // 匹配当前分组:空分组视为 "default" if (groupName == m_selectedGroup || (groupName.empty() && m_selectedGroup == "default")) { + // 文本筛选叠加在分组之上:先按分组,再按关键字 + if (filtering && !HostMatchesFilter(ctx, key)) continue; m_FilteredIndices.push_back(i); } } @@ -12426,8 +12533,14 @@ void CMy2015RemoteDlg::LoadListData(const std::string& group) m_CList_Online.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); } CString strStatusMsg; - strStatusMsg.FormatL("有%d个主机在线", (int)m_FilteredIndices.size()); - strStatusMsg += CString("[Total: ") + std::to_string(m_HostList.size()).c_str() + "]"; + if (m_strHostFilter.IsEmpty()) { + strStatusMsg.FormatL("有%d个主机在线", (int)m_FilteredIndices.size()); + strStatusMsg += CString("[Total: ") + std::to_string(m_HostList.size()).c_str() + "]"; + } else { + // 筛选时换个说法,否则“有 12 个主机在线”会被读成“只有 12 台在线” + strStatusMsg.FormatL("筛选结果:%d / 共 %d", + (int)m_FilteredIndices.size(), (int)m_HostList.size()); + } m_StatusBar.SetPaneText(0, strStatusMsg); } @@ -12511,7 +12624,37 @@ void CMy2015RemoteDlg::OnOnlineRegroup() void CMy2015RemoteDlg::MachineManage(MachineCommand type) { - if (MessageBoxL("此操作需客户端具有管理员权限,确定继续吗? ", "提示", MB_ICONQUESTION | MB_YESNO) == IDYES) { + // 操作名直接复用「机器管理」菜单里的词条(注销/关机/重启),三种语言都已翻译, + // 不新增词条。原来三个操作共用一句「此操作需客户端具有管理员权限,确定继续吗?」, + // 用户看不出自己点的是关机还是重启、也看不出对哪台执行。 + CString action = type == MACHINE_LOGOUT ? _TR("注销") + : type == MACHINE_SHUTDOWN ? _TR("关机") + : _TR("重启"); + + // 目标清单只用于展示:确认框是模态的,期间列表可能重排或主机下线,所以这里读完 + // 就把指针丢掉,真正执行时再按 clientID 重新解析一次(见下面的 ResolveCommandTargets)。 + EnterCriticalSection(&m_cs); + std::vector preview = ResolveCommandTargets(); + const int targetCount = (int)preview.size(); + CString targetList = DescribeTargetHosts(preview, 5); + LeaveCriticalSection(&m_cs); + + if (targetCount == 0) return; // 没选中主机时不弹空确认框 + + // 两行分开写:一行只有一个占位符,翻译成别的语序时不会把 %d 和 %s 对调。 + CString msg; + msg.Format(_TRF("确定要执行「%s」吗?"), action.GetString()); + msg += _T("\r\n\r\n"); + CString head; + head.Format(_TRF("目标主机(共 %d 台):"), targetCount); + msg += head; + msg += _T("\r\n"); + msg += targetList; + msg += _T("\r\n\r\n"); + msg += _TR("此操作需要被控端具有管理员权限。"); + + // 默认按钮是「否」:这类操作不可撤销,回车不应直接确认 + if (MessageBox(msg, _TR("提示"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) { EnterCriticalSection(&m_cs); // 确认框期间列表可能已重排,目标由 ResolveCommandTargets 按 clientID 还原 for (context* ContextObject : ResolveCommandTargets()) { diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h index b17ce70..fa069b1 100644 --- a/server/2015Remote/2015RemoteDlg.h +++ b/server/2015Remote/2015RemoteDlg.h @@ -432,6 +432,13 @@ public: std::string m_selectedGroup; std::string m_v2KeyPath; // V2 密钥文件路径 void RebuildFilteredIndices(); // 重建过滤索引 + // 主机列表的文本筛选(Ctrl+F 搜索栏)。空串表示不筛选;只影响列表显示的行, + // 不改动 m_HostList,也不影响任何按 clientID 解析目标的命令路径。 + void SetHostFilter(const CString& text); + CString GetHostFilter() const { return m_strHostFilter; } + CString m_strHostFilter; // 当前筛选文本(只在 UI 线程读写) + // 主机是否命中筛选关键字(key 已转小写)。调用方需持有 m_cs。 + bool HostMatchesFilter(context* ctx, const CString& lowerKey); context* GetContextByListIndex(int iItem); // 根据列表索引获取 context(考虑分组过滤) // 按 clientID 把选中项恢复到它们当前所在的行号。虚拟列表的选中项是按行号保存的, // 而 m_HostList 会随主机上下线重排,同一个行号重排后往往指向另一台主机。 @@ -439,6 +446,9 @@ public: // 本次命令的目标主机:右键菜单派发期间(m_CtxMenuTargets 非空)以 clientID 快照为准, // 否则取列表当前选中项。调用方需持有 m_cs。 std::vector ResolveCommandTargets(); + // 危险操作确认框里的目标清单:「备注(没有则计算机名)(IP)」,超过 maxShow 台时 + // 只列前 maxShow 台、末尾补一行省略号。只读列表数据,调用方需持有 m_cs。 + CString DescribeTargetHosts(const std::vector& targets, int maxShow); // 右键菜单发起时锁定的目标主机(clientID 快照)。菜单弹出到命令真正执行之间还会插入 // MessageBoxL / DoModal 等模态框,模态循环里 WM_TIMER 照常派发、列表照常重排,命令 // 处理函数若在那之后再按行号读选中项,就会读到另一台主机。只在 UI 线程访问。 diff --git a/server/2015Remote/FeatureLimitsDlg.cpp b/server/2015Remote/FeatureLimitsDlg.cpp index e60667d..715be21 100644 --- a/server/2015Remote/FeatureLimitsDlg.cpp +++ b/server/2015Remote/FeatureLimitsDlg.cpp @@ -197,8 +197,8 @@ void CFeatureLimitsDlg::InitContextItems() { "黑白屏幕", CF_GRAY_DESKTOP, HIDE_CTX_GRAY_DESKTOP }, { "浏览窗口", CF_VIEW_WND, HIDE_CTX_VIEW_WND }, { "播放快照", CF_SCREENPREVIEW_LOOP, HIDE_CTX_SCREENPREVIEW_LOOP }, - { "高速屏幕", CF_REMOTE_DESKTOP, HIDE_CTX_REMOTE_DESKTOP }, - { "极速屏幕", CF_H264_DESKTOP, HIDE_CTX_H264_DESKTOP }, + { "高清屏幕", CF_REMOTE_DESKTOP, HIDE_CTX_REMOTE_DESKTOP }, + { "流畅屏幕", CF_H264_DESKTOP, HIDE_CTX_H264_DESKTOP }, // 机器管理子菜单 { "注销", CF_MACHINE_LOGOUT, HIDE_CTX_MACHINE_LOGOUT }, { "关机", CF_MACHINE_SHUTDOWN, HIDE_CTX_MACHINE_SHUTDOWN }, diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp index bf4cad9..83e1b1e 100644 --- a/server/2015Remote/ScreenSpyDlg.cpp +++ b/server/2015Remote/ScreenSpyDlg.cpp @@ -446,6 +446,16 @@ void CScreenSpyDlg::DoDataExchange(CDataExchange* pDX) // ========== CStatusInfoWnd 实现 ========== +namespace { + // 原来宽度是写死的 170:档位名后面一旦跟出「(链路改善)」「(带宽不足)」这类 + // 切档原因,文本就被截掉。改成按文本实测宽度,170 退化成下限。 + const int kStatusInfoMinWidth = 170; + const int kStatusInfoHeight = 24; + const int kStatusInfoPadX = 16; // 文本左右留白 + // 宽度按 16px 取整:FPS / KB/s 每秒都在变,位数进位会让窗口每秒抖动一两个像素 + const int kStatusInfoWidthStep = 16; +} + BEGIN_MESSAGE_MAP(CStatusInfoWnd, CWnd) ON_WM_PAINT() ON_WM_ERASEBKGND() @@ -473,14 +483,54 @@ BOOL CStatusInfoWnd::Create(CWnd* pParent) } if (!CreateEx(dwExStyle, szClassName, _T(""), dwStyle, - CRect(0, 0, 170, 24), pParent, 0)) + CRect(0, 0, m_nWidth, kStatusInfoHeight), pParent, 0)) return FALSE; + // 字体建一次给绘制和测量共用:两边字体不一致的话,算出来的宽度和画出来的宽度 + // 就对不上,仍然会截字。 + m_infoFont.CreatePointFont(90, _T("Segoe UI")); + SetLayeredWindowAttributes(0, 220, LWA_ALPHA); LoadSettings(); return TRUE; } +int CStatusInfoWnd::MeasureWidth() +{ + if (m_strInfo.IsEmpty()) + return kStatusInfoMinWidth; + + CClientDC dc(this); + CFont* pOldFont = dc.SelectObject(&m_infoFont); + CSize sz = dc.GetTextExtent(m_strInfo); + dc.SelectObject(pOldFont); + + int w = sz.cx + kStatusInfoPadX * 2; + if (w < kStatusInfoMinWidth) + w = kStatusInfoMinWidth; + w = (w + kStatusInfoWidthStep - 1) / kStatusInfoWidthStep * kStatusInfoWidthStep; + return w; +} + +void CStatusInfoWnd::ResizeToFit() +{ + if (!GetSafeHwnd()) + return; + + const int w = MeasureWidth(); + if (w == m_nWidth) + return; + + CRect rc; + GetWindowRect(&rc); + m_nWidth = w; + // 两边各让一半,保持中心不动:默认位置是屏幕居中,拖动过的是用户选的中心点, + // 只往右边长会让这两种情况都偏。 + const int dx = (rc.Width() - w) / 2; + SetWindowPos(NULL, rc.left + dx, rc.top, w, rc.Height(), + SWP_NOZORDER | SWP_NOACTIVATE); +} + void CStatusInfoWnd::UpdateInfo(double fps, double kbps, const CString& quality) { if (kbps >= 1024) @@ -488,6 +538,10 @@ void CStatusInfoWnd::UpdateInfo(double fps, double kbps, const CString& quality) else m_strInfo.Format(_T("%.0f FPS | %.0f KB/s | %s"), fps, kbps, quality.GetString()); + // 文本变了宽度就可能变(切档原因的四种文案长度不同),隐藏时也算, + // 免得下次 Show 出来先窄一帧再撑开。 + ResizeToFit(); + if (m_bVisible) Invalidate(FALSE); } @@ -518,7 +572,7 @@ void CStatusInfoWnd::SetOpacityLevel(int level) void CStatusInfoWnd::UpdatePosition(const RECT& rcMonitor) { - int width = 170, height = 24; + const int width = m_nWidth, height = kStatusInfoHeight; int monWidth = rcMonitor.right - rcMonitor.left; int x, y; @@ -651,9 +705,7 @@ void CStatusInfoWnd::OnPaint() // 文字 dc.SetBkMode(TRANSPARENT); dc.SetTextColor(RGB(220, 220, 220)); - CFont font; - font.CreatePointFont(90, _T("Segoe UI")); - CFont* pOldFont = dc.SelectObject(&font); + CFont* pOldFont = dc.SelectObject(&m_infoFont); dc.DrawText(m_strInfo, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); dc.SelectObject(pOldFont); } @@ -2631,7 +2683,7 @@ void CScreenSpyDlg::OnTimer(UINT_PTR nIDEvent) // 更新全屏状态信息窗口 if (m_pStatusInfoWnd && m_pStatusInfoWnd->IsVisible()) { CString qualityName = m_Settings.QualityLevel == QUALITY_DISABLED ? _T("Off") : - CString(GetQualityName(m_AdaptiveQuality.currentLevel)); + GetQualityDisplayName(); m_pStatusInfoWnd->UpdateInfo(m_dFrameRate, m_dTransferRate, qualityName); } } @@ -2658,7 +2710,7 @@ void CScreenSpyDlg::UpdateWindowTitle() // 构建质量名称:关闭显示 "Off",自适应和手动都会显示 "当前等级" CString qualityName = m_Settings.QualityLevel == QUALITY_DISABLED ? "" : - CString(" | ") + GetQualityName(m_AdaptiveQuality.currentLevel); + CString(" | ") + GetQualityDisplayName(); CString strTitle; UINT fps = (UINT)(m_dFrameRate + 0.5); // 四舍五入显示 @@ -2689,6 +2741,27 @@ const char* CScreenSpyDlg::GetQualityName(int level) return "Unknown"; } +// 记下"为什么切档"。只影响界面显示,不参与任何判据 —— 判据仍然只看 RTT / 吞吐。 +// 20 秒后自动失效:档位稳定在低档时用户更需要知道"链路一直差",而不是一直挂着 +// 一个已经过时的原因。手动选档时由 ApplyQualityLevel(persist=true) 清空。 +void CScreenSpyDlg::SetQualityChangeReason(LPCTSTR key) +{ + m_AdaptiveQuality.reason = _L(key); + m_AdaptiveQuality.reasonUntil = GetTickCount64() + 20000; +} + +CString CScreenSpyDlg::GetQualityDisplayName() +{ + CString name = GetQualityName(m_AdaptiveQuality.currentLevel); + if (!m_AdaptiveQuality.reason.IsEmpty() && + GetTickCount64() < m_AdaptiveQuality.reasonUntil) { + name += _T(" ("); + name += m_AdaptiveQuality.reason; + name += _T(")"); + } + return name; +} + void CScreenSpyDlg::UpdateQualityMenuCheck(CMenu* SysMenu) { if (!SysMenu) SysMenu = GetSystemMenu(FALSE); @@ -2931,6 +3004,8 @@ void CScreenSpyDlg::EvaluateQuality() targetLevel, m_AdaptiveQuality.levelCeiling); } if (dual) NoteAdaptiveChange(now); + // 原因只在这里可得:再往下就没有 byLoad / levelRTT 了 + SetQualityChangeReason(byLoad ? _T("带宽不足") : _T("延迟高")); ApplyQualityLevel(targetLevel); if (byLoad) m_AdaptiveQuality.loadProbeTime = GetTickCount64(); } @@ -2948,6 +3023,7 @@ void CScreenSpyDlg::EvaluateQuality() m_AdaptiveQuality.lastUpFromLevel = currentLevel; NoteAdaptiveChange(now); } + SetQualityChangeReason(_T("链路改善")); ApplyQualityLevel(currentLevel - 1); } } @@ -3006,6 +3082,9 @@ void CScreenSpyDlg::ApplyQualityLevel(int level, bool persist) m_AdaptiveQuality.lockUntil = 0; m_AdaptiveQuality.changeWindowStart = 0; m_AdaptiveQuality.changeCountInWindow = 0; + // 用户自己点的档位,不需要解释"为什么变";顺手清掉上一次自适应留下的原因 + m_AdaptiveQuality.reason.Empty(); + m_AdaptiveQuality.reasonUntil = 0; } // 1. 发送 FPS 和算法 (persist=1 表示手动选择需要保存) @@ -3579,6 +3658,9 @@ void CScreenSpyDlg::EnterFullScreen() m_pStatusInfoWnd = new CStatusInfoWnd(); m_pStatusInfoWnd->Create(this); } + // 先把宽度按当前文本算出来再定位,否则第一次显示会先窄一帧再撑开 + m_pStatusInfoWnd->UpdateInfo(m_dFrameRate, m_dTransferRate, + m_Settings.QualityLevel == QUALITY_DISABLED ? _T("Off") : GetQualityDisplayName()); m_pStatusInfoWnd->UpdatePosition(rcMonitor); // 同步工具栏透明度 if (m_pToolbar) { diff --git a/server/2015Remote/ScreenSpyDlg.h b/server/2015Remote/ScreenSpyDlg.h index 2a13f74..e8f9704 100644 --- a/server/2015Remote/ScreenSpyDlg.h +++ b/server/2015Remote/ScreenSpyDlg.h @@ -184,6 +184,13 @@ private: int m_nOpacityLevel; bool m_bVisible; + // 宽度按文本自适应。原来写死 170,档位名后面跟出「(链路改善)」这类切档原因时 + // 会被截断;170 现在只是下限。 + int m_nWidth = 170; + CFont m_infoFont; // 绘制与测量共用,Create 里建一次 + int MeasureWidth(); // 当前文本的窗口宽度(不小于下限,按 16px 取整) + void ResizeToFit(); // 宽度有变化时改窗口大小,保持中心不动 + // 拖动支持 bool m_bDragging; CPoint m_ptDragStart; @@ -410,6 +417,11 @@ public: ULONGLONG changeWindowStart = 0; // 当前统计窗口起点 int changeCountInWindow = 0; // 窗口内的自适应切换次数 ULONGLONG lockUntil = 0; // 锁档截止时间(0=未锁) + // ===== 档位变化的可见原因(纯界面提示,不参与任何判据)===== + // 记下最近一次自动切档的原因和显示截止时间:标题栏/全屏信息窗在切换后 20 秒内 + // 显示「Good (延迟高)」,之后退回纯档位名,避免一直占着标题栏。 + CString reason; // 空 = 不显示原因 + ULONGLONG reasonUntil = 0; } m_AdaptiveQuality; volatile bool m_bResolutionChanging = false; // 分辨率切换中,阻止解码 @@ -485,6 +497,10 @@ public: void ApplyQualityLevel(int level, bool persist = false); // 应用质量等级 void NoteAdaptiveChange(ULONGLONG now); // 自适应切换频率计数,超限则锁档 const char* GetQualityName(int level); // 获取质量等级名称 + // 记下"为什么切档",供标题栏/全屏信息窗显示。key 传中文原文,内部按当前语言查表。 + void SetQualityChangeReason(LPCTSTR key); + // 档位名 +(20 秒内有效的切换原因),如 "Good (延迟高)" + CString GetQualityDisplayName(); void UpdateQualityMenuCheck(CMenu* SysMenu = nullptr); // 更新质量菜单勾选状态 void OnTimer(UINT_PTR nIDEvent); diff --git a/server/2015Remote/SearchBarDlg.cpp b/server/2015Remote/SearchBarDlg.cpp index 5382e6b..81c724c 100644 --- a/server/2015Remote/SearchBarDlg.cpp +++ b/server/2015Remote/SearchBarDlg.cpp @@ -8,7 +8,6 @@ IMPLEMENT_DYNAMIC(CSearchBarDlg, CDialogEx) CSearchBarDlg::CSearchBarDlg(CMy2015RemoteDlg* pParent) : CDialogLangEx(IDD_SEARCH_BAR, pParent) , m_pParent(pParent) - , m_nCurrentIndex(-1) { m_brushEdit.CreateSolidBrush(RGB(60, 60, 60)); m_brushStatic.CreateSolidBrush(RGB(40, 40, 40)); @@ -153,6 +152,15 @@ void CSearchBarDlg::Hide() { KillTimer(TIMER_SEARCH); // 清理定时器 ShowWindow(SW_HIDE); + + // 关掉搜索栏就撤掉筛选。否则列表停在被筛过的状态,用户看到“少了很多机器” + // 却找不到原因 —— 筛选条已经关掉了,没有任何地方提示当前处于筛选状态。 + if (m_pParent && !m_strLastSearch.IsEmpty()) { + m_strLastSearch.Empty(); + m_editSearch.SetWindowText(_T("")); + m_pParent->SetHostFilter(CString()); + } + // 将焦点还给主窗口列表 if (m_pParent) { m_pParent->SetFocus(); @@ -164,20 +172,10 @@ void CSearchBarDlg::InvalidateCache() // 杀掉 pending 的搜索定时器,避免竞争条件 KillTimer(TIMER_SEARCH); - // 清空搜索缓存 - m_strLastSearch.Empty(); - m_Results.clear(); - m_nCurrentIndex = -1; - - // 如果搜索栏存在且可见,立即重新搜索并更新界面 + // 筛选本身由主窗口的 RebuildFilteredIndices 维护(切分组、主机上下线都会重建), + // 这里只需要把计数刷新一下。 if (GetSafeHwnd() && IsWindowVisible()) { - CString searchText; - m_editSearch.GetWindowText(searchText); - if (!searchText.IsEmpty()) { - DoSearch(); - } else { - UpdateCountText(); - } + UpdateCountText(); } } @@ -218,98 +216,28 @@ void CSearchBarDlg::DoSearch() { CString searchText; m_editSearch.GetWindowText(searchText); + searchText.Trim(); - // 空文本时清空结果 - if (searchText.IsEmpty()) { - m_Results.clear(); - m_nCurrentIndex = -1; - m_strLastSearch.Empty(); - UpdateCountText(); - return; - } - - // 相同文本不重复搜索(注意:Tab 切换时 m_strLastSearch 会被清空,强制重新搜索) - if (searchText == m_strLastSearch && !m_Results.empty()) { - return; - } + if (searchText == m_strLastSearch) return; m_strLastSearch = searchText; - // 大小写不敏感 - searchText.MakeLower(); - m_Results.clear(); - if (!m_pParent) return; - // 获取当前选中项的 clientID,用于确定搜索起始位置 - uint64_t selectedClientID = 0; - POSITION pos = m_pParent->m_CList_Online.GetFirstSelectedItemPosition(); - if (pos) { - int nSelectedItem = m_pParent->m_CList_Online.GetNextSelectedItem(pos); - EnterCriticalSection(&m_pParent->m_cs); - context* selCtx = m_pParent->GetContextByListIndex(nSelectedItem); - if (selCtx) selectedClientID = selCtx->GetClientID(); - LeaveCriticalSection(&m_pParent->m_cs); - } + // 交给主窗口按文本重建过滤索引:命中的主机才留在列表里。 + // 原来的实现是“在列表里找下一个匹配项并跳过去”,机器一多(几千台)就没法用: + // 用户想的是“把带 LEVI 的都列出来”,而不是一条条按 F3 翻。 + m_pParent->SetHostFilter(searchText); - // 加锁保护:访问 m_FilteredIndices, m_HostList, context - EnterCriticalSection(&m_pParent->m_cs); - - // 遍历过滤后的列表,存储匹配项的 clientID(而非索引) - int count = (int)m_pParent->m_FilteredIndices.size(); - for (int i = 0; i < count; i++) { - context* ctx = m_pParent->GetContextByListIndex(i); - if (!ctx) continue; - - bool matched = false; - - // 搜索各列:IP(0), 地理位置(2), 计算机名/备注(3), 操作系统(4), 版本(8) - int cols[] = { 0, 2, 3, 4, 8 }; - for (int col : cols) { - CString colText; - - // 备注列特殊处理 - if (col == 3) { // ONLINELIST_COMPUTER_NAME - colText = m_pParent->m_ClientMap->GetClientMapData(ctx->GetClientID(), MAP_NOTE); - if (colText.IsEmpty()) { - colText = ctx->GetClientData(col); - } - } else { - colText = ctx->GetClientData(col); - } - - // 地理位置列已统一按 UTF-8 存储(见 AddList),而搜索输入是 CP_ACP; - // 转回 CP_ACP 再比对,否则按中文位置搜索会因编码不一致而失配。 - if (col == ONLINELIST_LOCATION) { - colText = CString(Utf8ToAnsi(std::string(colText.GetString())).c_str()); - } - - colText.MakeLower(); - if (colText.Find(searchText) >= 0) { - matched = true; - break; - } + // 列表已经被筛过,把选中项放到第一行,键盘可以直接接着操作 + CListCtrl& list = m_pParent->m_CList_Online; + const int count = list.GetItemCount(); + if (count > 0) { + int sel = -1; + while ((sel = list.GetNextItem(sel, LVNI_SELECTED)) != -1) { + list.SetItemState(sel, 0, LVIS_SELECTED | LVIS_FOCUSED); } - - if (matched) { - m_Results.push_back(ctx->GetClientID()); - } - } - - LeaveCriticalSection(&m_pParent->m_cs); - - // 定位到最接近当前选中项的结果 - m_nCurrentIndex = -1; - if (!m_Results.empty()) { - m_nCurrentIndex = 0; - if (selectedClientID != 0) { - for (int i = 0; i < (int)m_Results.size(); i++) { - if (m_Results[i] == selectedClientID) { - m_nCurrentIndex = i; - break; - } - } - } - GotoResult(m_nCurrentIndex); + list.SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + list.EnsureVisible(0, FALSE); } UpdateCountText(); @@ -317,113 +245,52 @@ void CSearchBarDlg::DoSearch() void CSearchBarDlg::GotoPrev() { - if (m_Results.empty()) return; - - m_nCurrentIndex--; - if (m_nCurrentIndex < 0) { - m_nCurrentIndex = (int)m_Results.size() - 1; // 循环 - } - GotoResult(m_nCurrentIndex); - UpdateCountText(); + MoveSelection(-1); } void CSearchBarDlg::GotoNext() { - if (m_Results.empty()) return; - - m_nCurrentIndex++; - if (m_nCurrentIndex >= (int)m_Results.size()) { - m_nCurrentIndex = 0; // 循环 - } - GotoResult(m_nCurrentIndex); - UpdateCountText(); + MoveSelection(+1); } -int CSearchBarDlg::FindListIndexByClientID(uint64_t clientID) -{ - if (!m_pParent || clientID == 0) return -1; - - // 加锁查找 - EnterCriticalSection(&m_pParent->m_cs); - int count = (int)m_pParent->m_FilteredIndices.size(); - for (int i = 0; i < count; i++) { - context* ctx = m_pParent->GetContextByListIndex(i); - if (ctx && ctx->GetClientID() == clientID) { - LeaveCriticalSection(&m_pParent->m_cs); - return i; - } - } - LeaveCriticalSection(&m_pParent->m_cs); - return -1; -} - -void CSearchBarDlg::GotoResult(int index) +// 在(已经筛选过的)列表里上下移动选中项。列表本身就是结果集, +// 所以这里不再需要维护 clientID → 行号的映射表。 +void CSearchBarDlg::MoveSelection(int delta) { if (!m_pParent) return; - // 循环查找有效结果(避免递归导致栈溢出) - int attempts = 0; - int maxAttempts = (int)m_Results.size(); + CListCtrl& list = m_pParent->m_CList_Online; + const int count = list.GetItemCount(); + if (count <= 0) return; - while (attempts < maxAttempts) { - if (index < 0 || index >= (int)m_Results.size()) { - m_nCurrentIndex = -1; - UpdateCountText(); - return; - } + const int cur = list.GetNextItem(-1, LVNI_SELECTED); + int next = (cur < 0) ? 0 : cur + delta; + if (next < 0) next = count - 1; // 循环 + if (next >= count) next = 0; // 循环 - uint64_t clientID = m_Results[index]; - int listIndex = FindListIndexByClientID(clientID); - - if (listIndex >= 0) { - // 找到有效结果 - m_nCurrentIndex = index; - - // 取消所有选中 - int nItem = -1; - while ((nItem = m_pParent->m_CList_Online.GetNextItem(-1, LVNI_SELECTED)) != -1) { - m_pParent->m_CList_Online.SetItemState(nItem, 0, LVIS_SELECTED | LVIS_FOCUSED); - } - - // 选中并滚动到目标项 - m_pParent->m_CList_Online.SetItemState(listIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); - m_pParent->m_CList_Online.EnsureVisible(listIndex, FALSE); - return; - } - - // 该主机不在当前列表中,移除并尝试下一个 - m_Results.erase(m_Results.begin() + index); - if (m_Results.empty()) { - m_nCurrentIndex = -1; - UpdateCountText(); - return; - } - - // 调整索引继续查找 - if (index >= (int)m_Results.size()) { - index = 0; - } - attempts++; + if (cur >= 0) { + list.SetItemState(cur, 0, LVIS_SELECTED | LVIS_FOCUSED); } - - // 所有结果都失效 - m_Results.clear(); - m_nCurrentIndex = -1; - UpdateCountText(); + list.SetItemState(next, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + list.EnsureVisible(next, FALSE); } void CSearchBarDlg::UpdateCountText() { CString text; - if (m_Results.empty()) { - CString searchText; - m_editSearch.GetWindowText(searchText); - if (!searchText.IsEmpty()) { - text = _T("Not found"); + CString searchText; + m_editSearch.GetWindowText(searchText); + searchText.Trim(); + + if (!searchText.IsEmpty() && m_pParent) { + const int count = m_pParent->m_CList_Online.GetItemCount(); + if (count > 0) { + text.Format(_T("%d"), count); // 匹配台数(列表里就这么多行) + } else { + text = _TR("无匹配"); } - } else { - text.Format(_T("%d/%d"), m_nCurrentIndex + 1, (int)m_Results.size()); } + m_staticCount.SetWindowText(text); m_staticCount.Invalidate(); m_staticCount.UpdateWindow(); diff --git a/server/2015Remote/SearchBarDlg.h b/server/2015Remote/SearchBarDlg.h index 48587dc..1156dc6 100644 --- a/server/2015Remote/SearchBarDlg.h +++ b/server/2015Remote/SearchBarDlg.h @@ -28,20 +28,16 @@ public: CToolTipCtrl m_tooltip; // 搜索状态 - std::vector m_Results; // 匹配项的 clientID(而非索引,避免列表变化导致失效) - int m_nCurrentIndex; // 当前高亮的结果索引 - CString m_strLastSearch; // 上次搜索文本 - - int FindListIndexByClientID(uint64_t clientID); // 根据 clientID 查找当前列表索引 + CString m_strLastSearch; // 上次已应用到列表的筛选文本 // 方法 void Show(); // 显示搜索栏 - void Hide(); // 隐藏搜索栏 - void DoSearch(); // 执行搜索 - void InvalidateCache(); // 清空搜索缓存(Tab切换时调用) - void GotoPrev(); // 上一个结果 - void GotoNext(); // 下一个结果 - void GotoResult(int index); // 跳转到指定结果 + void Hide(); // 隐藏搜索栏(同时撤掉筛选) + void DoSearch(); // 应用筛选(输入防抖后调用) + void InvalidateCache(); // 刷新计数(Tab切换/列表变化时调用) + void GotoPrev(); // 选中上一行 + void GotoNext(); // 选中下一行 + void MoveSelection(int delta); // 在筛选结果内移动选中项 void UpdateCountText(); // 更新计数显示 void UpdatePosition(); // 更新位置(居中于父窗口) diff --git a/server/2015Remote/UIBranding.h b/server/2015Remote/UIBranding.h index 869c654..f6e62fa 100644 --- a/server/2015Remote/UIBranding.h +++ b/server/2015Remote/UIBranding.h @@ -267,8 +267,8 @@ #define HIDE_CTX_GRAY_DESKTOP 0 // 黑白屏幕 #define HIDE_CTX_VIEW_WND 0 // 浏览窗口 #define HIDE_CTX_SCREENPREVIEW_LOOP 0 // 播放快照 -#define HIDE_CTX_REMOTE_DESKTOP 0 // 高速屏幕 -#define HIDE_CTX_H264_DESKTOP 0 // 极速屏幕 +#define HIDE_CTX_REMOTE_DESKTOP 0 // 高清屏幕(DXGI + 差分) +#define HIDE_CTX_H264_DESKTOP 0 // 流畅屏幕(GDI + H264) #define HIDE_CTX_PRIVATE_SCREEN 0 // 隐私屏幕 // --- 授权管理 --- diff --git a/server/2015Remote/lang/de_DE.ini b/server/2015Remote/lang/de_DE.ini index 6118e86..e262d41 100644 --- a/server/2015Remote/lang/de_DE.ini +++ b/server/2015Remote/lang/de_DE.ini @@ -223,8 +223,8 @@ RTT=RTT »­ÖÊ=Qualitaet ֡ÂÊ=FPS ºڰׯÁĻ=Graustufen -¸ßËÙÆÁĻ=Hohe Geschwindigkeit -¼«ËÙÆÁĻ=Ultra-Geschwindigkeit +¸ßÇåÆÁĻ=Hohe Bildqualitaet +Á÷³©ÆÁĻ=Fluessige Wiedergabe ÆÁϽØͼ·½·¨:=Aufnahme: ͼÏñѹËõ·½·¨:=Komprimierung: ¶àÏÔʾÆ÷֧³Ö:=Multi-Monitor: @@ -2233,3 +2233,13 @@ HTTPS Ìáʾ: ¿ͻ§¶Ëģ°åÀïûÓÐÄÚǶê¿飬±¾´ΰ´ÆÕͨ¿ͻ§¶ËÉú³ɣ»Öرà ghost/ServerDll ×ÊԴºó¿ÉÔٴÎÆôÓá£=Hinweis: Die Client-Vorlage hat keinen eingebetteten Ankerblock; als normaler Client erzeugt. ghost/ServerDll-Ressourcen neu bauen, um die Option wieder zu nutzen. Ìáʾ: δÄÚǶTLSÐÅÈÎ꣬±¾Åú¿ͻ§¶ËÊ״ÎÁ¬½ÓΪÃ÷Îģ¬ÐèÖ÷¿ØÔÚÏßÏ·¢ê¡£=Hinweis: kein TLS-Vertrauensanker eingebettet; diese Clients verbinden sich zuerst im Klartext und benoetigen den Anker vom Master. %d ̨Ö÷»úʹÓÃÉú³ÉʱÄÚǶµÄÐÅÈÎ꣺ȡÏû TLS ºó±ØÐëÖØÐÂÁ¬ÉÏÖ÷¿زÅÄָܻ´¼ÓÃܣ¬ÀëÏ߯ڼ䲻»á×ÔÐлָ´¡£=%d Host(s) nutzen den beim Build eingebetteten Vertrauensanker: nach dem Deaktivieren von TLS muessen sie sich erneut mit dem Master verbinden; offline erholen sie sich nicht selbst. +ȷ¶¨ҪִÐС¸%s¡¹Âð£¿=Soll "%s" wirklich ausgefuehrt werden? +Ŀ±êÖ÷»ú£¨¹² %d ̨£©£º=Zielhost(s), insgesamt %d: +´˲Ù×÷ÐèҪ±»¿ض˾ßÓйÜÀíԱȨÏޡ£=Dieser Vorgang erfordert Administratorrechte auf dem Client. +ȷ¶¨Ҫ¶Ͽª²¢ɾ³ýÒÔÏ %d ̨Ö÷»úÂð£¿=Die folgenden %d Host(s) trennen und entfernen? +ȷ¶¨ҪжÔØÒÔÏ %d ̨Ö÷»úÉϵı»¿سÌÐòÂð£¿=Client auf den folgenden %d Host(s) deinstallieren? +ÎÞƥÅä=Kein Treffer +ɸѡ½á¹û£º%d / ¹² %d=Gefiltert: %d / %d gesamt +Ñӳٸß=hohe Latenz +´ø¿í²»×ã=geringe Bandbreite +Á´·¸ÄÉÆ=Link wieder gut diff --git a/server/2015Remote/lang/en_US.ini b/server/2015Remote/lang/en_US.ini index 14e65aa..9b42988 100644 --- a/server/2015Remote/lang/en_US.ini +++ b/server/2015Remote/lang/en_US.ini @@ -226,8 +226,8 @@ RTT=RTT »­ÖÊ=Quality ֡ÂÊ=FPS ºڰׯÁĻ=Grayscale -¸ßËÙÆÁĻ=High Speed -¼«ËÙÆÁĻ=Ultra Speed +¸ßÇåÆÁĻ=High Quality +Á÷³©ÆÁĻ=Smooth ÆÁϽØͼ·½·¨:=Capture: ͼÏñѹËõ·½·¨:=Compress: ¶àÏÔʾÆ÷֧³Ö:=Multi-Mon: @@ -2245,3 +2245,13 @@ MCP: Ìáʾ: ¿ͻ§¶Ëģ°åÀïûÓÐÄÚǶê¿飬±¾´ΰ´ÆÕͨ¿ͻ§¶ËÉú³ɣ»Öرà ghost/ServerDll ×ÊԴºó¿ÉÔٴÎÆôÓá£=Note: the client template has no embedded anchor block; generated as a plain client. Rebuild the ghost/ServerDll resources to enable it again. Ìáʾ: δÄÚǶTLSÐÅÈÎ꣬±¾Åú¿ͻ§¶ËÊ״ÎÁ¬½ÓΪÃ÷Îģ¬ÐèÖ÷¿ØÔÚÏßÏ·¢ê¡£=Note: no TLS trust anchor embedded; these clients connect in plaintext first and need the master to push the anchor online. %d ̨Ö÷»úʹÓÃÉú³ÉʱÄÚǶµÄÐÅÈÎ꣺ȡÏû TLS ºó±ØÐëÖØÐÂÁ¬ÉÏÖ÷¿زÅÄָܻ´¼ÓÃܣ¬ÀëÏ߯ڼ䲻»á×ÔÐлָ´¡£=%d host(s) use the trust anchor embedded at build time: after disabling TLS they must reconnect to the master to restore encryption and will not recover on their own while offline. +ȷ¶¨ҪִÐС¸%s¡¹Âð£¿=Are you sure you want to run "%s"? +Ŀ±êÖ÷»ú£¨¹² %d ̨£©£º=Target host(s), %d in total: +´˲Ù×÷ÐèҪ±»¿ض˾ßÓйÜÀíԱȨÏޡ£=This operation requires the client to run with administrator privileges. +ȷ¶¨Ҫ¶Ͽª²¢ɾ³ýÒÔÏ %d ̨Ö÷»úÂð£¿=Disconnect and remove the following %d host(s)? +ȷ¶¨ҪжÔØÒÔÏ %d ̨Ö÷»úÉϵı»¿سÌÐòÂð£¿=Uninstall the client from the following %d host(s)? +ÎÞƥÅä=No match +ɸѡ½á¹û£º%d / ¹² %d=Filtered: %d / %d total +Ñӳٸß=high latency +´ø¿í²»×ã=low bandwidth +Á´·¸ÄÉÆ=link improved diff --git a/server/2015Remote/lang/zh_TW.ini b/server/2015Remote/lang/zh_TW.ini index c1216e1..9f1a3b8 100644 --- a/server/2015Remote/lang/zh_TW.ini +++ b/server/2015Remote/lang/zh_TW.ini @@ -225,8 +225,8 @@ RTT=RTT »­ÖÊ=®‹Ù| ֡ÂÊ=Ӱ¸ñÂÊ ºڰׯÁĻ=ºڰ×ΞĻ -¸ßËÙÆÁĻ=¸ßËÙΞĻ -¼«ËÙÆÁĻ=˜OËÙΞĻ +¸ßÇåÆÁĻ=¸߮‹Ù|ΞĻ +Á÷³©ÆÁĻ=Á÷•³ΞĻ ÆÁϽØͼ·½·¨:=ΞĻ”Xȡ·½·¨: ͼÏñѹËõ·½·¨:=ӰÏ񉺿s·½·¨: ¶àÏÔʾÆ÷֧³Ö:=¶àΞĻ֧Ԯ: @@ -2238,3 +2238,13 @@ MCP: Ìáʾ: ¿ͻ§¶Ëģ°åÀïûÓÐÄÚǶê¿飬±¾´ΰ´ÆÕͨ¿ͻ§¶ËÉú³ɣ»Öرà ghost/ServerDll ×ÊԴºó¿ÉÔٴÎÆôÓá£=Ìáʾ: ¿͑ô¶Ëģ°åÑe›]ÓЃÈǶå^‰K£¬±¾´ΰ´ÆÕͨ¿͑ô¶ËÉú³ɣ»ÖؾŽ ghost/ServerDll ÙYԴáá¿ÉÔٴΆ¢ÓᣠÌáʾ: δÄÚǶTLSÐÅÈÎ꣬±¾Åú¿ͻ§¶ËÊ״ÎÁ¬½ÓΪÃ÷Îģ¬ÐèÖ÷¿ØÔÚÏßÏ·¢ê¡£=Ìáʾ: δƒÈǶTLSÐÅÈÎå^£¬±¾Åú¿͑ô¶ËÊ״ÎßB½ӞéÃ÷Îģ¬ÐèÖ÷¿ؾ€ÉÏϰlå^¡£ %d ̨Ö÷»úʹÓÃÉú³ÉʱÄÚǶµÄÐÅÈÎ꣺ȡÏû TLS ºó±ØÐëÖØÐÂÁ¬ÉÏÖ÷¿زÅÄָܻ´¼ÓÃܣ¬ÀëÏ߯ڼ䲻»á×ÔÐлָ´¡£=%d ̨Ö÷™CʹÓÃÉú³ɕrƒÈǶµÄÐÅÈÎå^£ºȡÏû TLS áá±ØíšÖØÐÂßBÉÏÖ÷¿زÅÄܻ֏ͼÓÃܣ¬ëx¾€ÆÚég²»•þ×ÔÐл֏͡£ +ȷ¶¨ҪִÐС¸%s¡¹Âð£¿=´_¶¨ҪˆÌÐС¸%s¡¹†᣿ +Ŀ±êÖ÷»ú£¨¹² %d ̨£©£º=Ŀ˜ËÖ÷™C£¨¹² %d ̨£©£º +´˲Ù×÷ÐèҪ±»¿ض˾ßÓйÜÀíԱȨÏޡ£=´˲Ù×÷ÐèҪ±»¿ض˾ßÓйÜÀí†T™àÏޡ£ +ȷ¶¨Ҫ¶Ͽª²¢ɾ³ýÒÔÏ %d ̨Ö÷»úÂð£¿=´_¶¨Ҫ”àé_�K„h³ýÒÔÏ %d ̨Ö÷™C†᣿ +ȷ¶¨ҪжÔØÒÔÏ %d ̨Ö÷»úÉϵı»¿سÌÐòÂð£¿=´_¶¨Ҫ½â³ý°²ÑbÒÔÏ %d ̨Ö÷™CÉϵı»¿سÌʽ†᣿ +ÎÞƥÅä=Ÿo·ûºÏ +ɸѡ½á¹û£º%d / ¹² %d=ºYßx½Y¹û£º%d / ¹² %d +Ñӳٸß=ÑÓßt¸ß +´ø¿í²»×ã=îlŒ’²»×ã +Á´·¸ÄÉÆ=朷¸ÄÉÆ