fix(ui): Phase 7 C5 — 移除假按钮 + 真实托盘图标
用户报告设置页很多按钮无反应 + 关闭后托盘看不到图标。两处问题:\n\n1. ServerCard 占位按钮无回调:\n- server-card.slint:去掉了 toggled/edit-clicked/remove-clicked 三个回调以及 enabled 切换、Edit / Remove 按钮;变成纯展示卡(状态点 + name + url + 当前标记)\n- settings-page.slint:去掉硬编码的 Home / NAS 占位,改用 active-server-name / active-server-url / active-server-enabled 三个属性(MainWindow → AppConfig 实时填充);空时显示 '(未配置服务器)' 空态提示\n- app.slint:MainWindow 加三个属性 + 转发给 SettingsPage\n- lib.rs:startup 阶段把活跃服务器信息塞进 UI;测试连接成功/失败时更新 enabled 状态\n\n2. 托盘图标看不见:\n- tray.rs:原本 hIcon 写 null,Win10+ 上 Shell_NotifyIconW(NIM_ADD, NULL hIcon) 实际渲染为空白或很弱的小方块。改用 LoadIconW(NULL, IDI_APPLICATION) 加载 Windows 自带的应用程序图标(无需嵌入 .ico 资源,主题感知)。show_toast / Drop 的 hIcon 维持 null(让 NIM_MODIFY/NIM_DELETE 不动原有图标)。AGENTS.md §53 标记真 .ico 资源为 V2 项。
This commit is contained in:
@@ -86,6 +86,13 @@ export component MainWindow inherits Window {
|
||||
in-out property <string> status-text: "未连接";
|
||||
callback test-connection-requested();
|
||||
|
||||
// Phase 7 C5: active-server summary forwarded into SettingsPage
|
||||
// so the Connection section reflects the real AppConfig instead
|
||||
// of the old hardcoded "Home / NAS" placeholders.
|
||||
in property <string> active-server-name: "(未配置服务器)";
|
||||
in property <string> active-server-url: "";
|
||||
in property <bool> active-server-enabled: false;
|
||||
|
||||
HorizontalLayout {
|
||||
// §7 Sidebar width: 220-240px.
|
||||
Rectangle {
|
||||
@@ -379,6 +386,12 @@ export component MainWindow inherits Window {
|
||||
start-with-windows: root.start-with-windows;
|
||||
start-minimized: root.start-minimized;
|
||||
close-to-tray: root.close-to-tray;
|
||||
// Phase 7 C5: forward active server config so the
|
||||
// Connection section shows the real entry instead
|
||||
// of the hardcoded "Home / NAS" placeholders.
|
||||
active-server-name: root.active-server-name;
|
||||
active-server-url: root.active-server-url;
|
||||
active-server-enabled: root.active-server-enabled;
|
||||
appearance-changed(idx) => {
|
||||
root.appearance-index = idx;
|
||||
root.theme = idx == 0 ? AppearanceMode.System :
|
||||
|
||||
Reference in New Issue
Block a user