feat: add desktop start and native reminders

- Notify at schedule start and optionally N minutes before\n- Add reminder lead setting and TOML persistence\n- Use Linux DBus native notifications with action handling\n- Focus the matching block when a notification is clicked\n- Keep overdue reminders and update validation docs/screenshots
This commit is contained in:
Misaki
2026-10-26 21:16:07 +08:00
parent 121e66d527
commit 795f9730f8
23 changed files with 465 additions and 6 deletions
+69
View File
@@ -0,0 +1,69 @@
# 阶段 4.2 验证报告:桌面开始提醒 / 原生通知 / 点击定位
> 日期:2026-10-26
> 环境:Ubuntu 24.04 / GCC 13.3 / Qt 6.6.3(Linux DBus 通知)
## 1. 本次交付
1. **开始时间提醒**:时间块到达开始时间后发送系统通知;20 秒轮询,最多有 20 秒延迟。为避免启动时补发过多历史提醒,开始提醒只覆盖开始后 10 分钟内。
2. **提前 N 分钟提醒**:设置页可选择 0(仅开始时)、5、10、15、30、60 分钟;提前量保存在 TOML `[reminders] lead_minutes`。
3. **保留超时提醒**:结束时间后仍未完成的日程继续通知,并支持点击定位。
4. **原生通知**:
- Linux:`org.freedesktop.Notifications` DBus `Notify`,支持 `ActionInvoked`「打开日程」动作。
- Windows/macOS:`QSystemTrayIcon` 系统托盘通知,使用 `messageClicked` 处理点击。
5. **点击定位**:通知携带 block id;点击后打开详细日程并按日期定位到对应时间块。Linux DBus 使用通知 id → block id 映射;Windows/macOS 使用待处理 block id。
6. **设置同步**:设置对话框修改提前分钟后立即更新 NotificationService,并重新检查当前提醒。
## 2. 构建与自动化测试
```bash
cmake --preset linux-gcc
cmake --build --preset linux-gcc --clean-first -j$(nproc)
ctest --preset linux-gcc
```
| 项目 | 结果 |
|---|---|
| 客户端全量构建 | 成功,0 警告(`-Werror`) |
| `ctest --preset linux-gcc` | **12/12 通过** |
| 新增提醒测试 | `NotificationService` 提前/开始提醒各一次,重复检查不重复通知 |
| 配置测试 | `[reminders] lead_minutes` 默认值/写入/重载 |
完整输出见 [`ctest-phase-4-2.txt`](ctest-phase-4-2.txt)。
## 3. 界面截图
| 截图 | 说明 |
|---|---|
| [`settings-dark.png`](settings-dark.png) | 设置 · 日程提前提醒(深色) |
| [`settings-light.png`](settings-light.png) | 设置 · 日程提前提醒(浅色) |
系统通知截图未保存:当前验证环境没有可交互的桌面通知中心;通知发送路径通过代码审查和 Linux DBus 编译验证。
## 4. 行为说明
- 应用必须运行(窗口可最小化到托盘)。完全退出后不会提醒。
- 开始提醒:`now >= start` 且 `now < end` 且开始时间不超过 10 分钟前;只提醒一次。
- 提前提醒:`start - N <= now < start`;只提醒一次。
- 超时提醒:`now >= end` 且状态仍为 scheduled/in_progress;沿用原有逻辑。
- 提前量为 0 时不发提前提醒,仅开始时提醒。
- 通知点击:Linux DBus 点击「打开日程」;Windows/macOS 点击托盘通知。
- 通知状态只保存在内存,重启应用后可能再次提醒。
- 没有桌面开机自启(按要求未添加)。
## 5. 已知限制
1. 20 秒轮询不是精确闹钟;系统休眠或应用被挂起时可能延迟。
2. 应用必须运行;退出进程后无法提醒。
3. Linux 通知动作取决于桌面通知服务是否支持 actions;不支持时仍会显示通知,但点击可能只聚焦应用。
4. Windows/macOS 使用 Qt 托盘通知,具体视觉样式由系统决定;不是自绘窗口。
5. 通知去重仅在内存;重启后同一开始/提前提醒可能再次出现。
6. 没有开机自启(用户明确不要求)。
## 6. 人工验收建议
1. 设置提前提醒为 5 分钟,创建一条 6 分钟后开始的日程;等待/触发检查,确认收到系统通知。
2. 到开始时间再次收到「日程开始」通知;点击通知,确认打开详细日程并定位。
3. 把提前提醒改为「仅开始时」,确认不再出现提前通知。
4. 创建一条已结束但未完成的日程,确认原有超时通知仍工作且点击定位。
5. 最小化到托盘/隐藏主窗口,确认通知仍出现;退出应用后确认不再提醒。