Repository navigation
feat: migrate user notice feature - #460
yixinshark wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideMigrates the pre-login user notice to a new Qt6/Dtk executable, wiring it into the build and greeter launch path while providing asynchronous notice loading, acknowledgement gating, protected fullscreen presentation, safe background retrieval, and monitor transition handling. Sequence diagram for loading and acknowledging the user noticesequenceDiagram
participant Greeter
participant Notice as dde-user-notice
participant Config as UserNoticeConfig
participant Worker as QtConcurrent worker
participant UI as PreLoginWindow
Greeter->>Notice: start executable
Notice->>Config: noticePath()
Notice->>Worker: readNoticeContent(path)
Worker-->>UI: notice content
alt content loaded
UI->>UI: enable acknowledge button
UI-->>Greeter: display notice
Greeter->>UI: acknowledge()
UI->>Notice: quit()
else content unavailable
UI->>Notice: quit()
end
Sequence diagram for monitor transitions and background renderingsequenceDiagram
participant Qt as QGuiApplication
participant Manager as FullScreenManager
participant Window as FullScreen
participant ImageEffect as ImageEffect1
participant Worker as QtConcurrent worker
Qt->>Manager: screenCountChanged()
Manager->>Manager: isCopyMode()
Manager->>Manager: handleScreenChanged()
Manager->>Window: setScreen(screen)
Window->>Worker: getBackgroundImage(size, scale)
Window->>Worker: getBlurBackgroundImage(size, scale)
Worker->>ImageEffect: Get(background path)
ImageEffect-->>Worker: blurred image path
Worker-->>Window: background image
Window->>Window: repaint()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="dde-user-notice/misc/user_notice_check.sh" line_range="17" />
<code_context>
+ exit 1
+fi
+
+if [ ! -s "${userNoticePath}" ]; then
+ echo "${userNoticePath} does not exist, don't need process userNotice"
+ exit 1
</code_context>
<issue_to_address>
**Unreadable notices are skipped**
When the configured notice file exists and is nonempty but is not readable by the launched process, the pre-greeter check accepts any nonempty file, but `main` exits when that file cannot be opened. The configured notice then never appears, so the user can continue without acknowledging it.
Make the pre-greeter check and launch behavior handle unreadable notice files consistently so an unreadable configured notice cannot silently bypass acknowledgement.
Also at `dde-user-notice/src/main.cpp:80-82`.
</issue_to_address>
### Comment 2
<location path="dde-user-notice/misc/user_notice_check.sh" line_range="7-8" />
<code_context>
+#
+# 供 greeter 的 pre-greeter 调用:返回 0 表示需要显示"用户须知"
+
+userNoticePath=$(dde-dconfig --get -a org.deepin.dde.session.ui -r org.deepin.dde.session.ui -k userNoticePath 2>/dev/null)
+showUserNotice=$(dde-dconfig --get -a org.deepin.dde.session.ui -r org.deepin.dde.session.ui -k showUserNotice 2>/dev/null)
+
+userNoticePath=${userNoticePath//\"/}
</code_context>
<issue_to_address>
**Config errors skip the notice**
When `dde-dconfig` is unavailable or fails to read the settings, the script discards `dde-dconfig` errors and treats empty output as ordinary configuration; the empty path then fails the `-s` check and exits nonzero, so the greeter does not launch the notice and operators do not see the underlying error.
Check and report DConfig command failures separately from an intentionally disabled notice, and define launch behavior for the failure case.
</issue_to_address>66bf296 to
bc05d4a
Compare
6a00ad3 to
6b35725
Compare
Migrate dde-user-notice from the v20 session UI and integrate its build, installation, pre-greeter launcher, and DConfig settings with the Qt6 version. - Restore screen associations across mirror and extended display transitions. - Load background images using immutable worker inputs and the ImageEffect1 API. - Enable acknowledgement only after notice content is installed and reject explicit window closure while preserving monitor hotplug behavior. - Validate DConfig reads and notice readability before launching the notice. 从 v20 会话界面迁移 dde-user-notice,适配 Qt6,并接入构建安装、登录前启动脚本及 DConfig 配置。 - 修复镜像与扩展模式切换后的屏幕关联和窗口复用。 - 后台加载使用不可变输入,并更新为 ImageEffect1 接口。 - 内容显示后才允许确认,拦截显式关闭窗口,同时保留显示器热插拔行为。 - 启动前校验 DConfig 读取结果和用户须知文件可读性。 Log: migrate pre-login user notice to Qt6 Pms: TASK-396167 Change-Id: I5aec1b8955771ae37c2feecd0ec9c16659af6d0b
6b35725 to
8af4dc2
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['修正 main.cpp 中应用版本号为正确的版本', '在 FullScreen::setScreen() 中添加注释说明两个 QFutureWatcher 的优先级设计意图'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['将 setupPalette() 中的重复调用重构为遍历颜色角色列表的循环', '为 loadBackgroundImage 等关键函数添加函数级注释', '统一 Doxygen 注释格式'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['将魔法数字提取为命名常量或配置项,提升可维护性', '考虑将布局参数(间距、尺寸)集中管理'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['建议对 DConfig 返回的 userNoticePath 进行基本的路径合法性校验(如禁止包含 .. 的路径遍历),虽然当前 DConfig 需系统权限修改,但作为纵深防御可考虑'] 💡 改进建议代码示例// main.cpp - 修正版本号
app.setApplicationVersion("1.0.0");
// main.cpp - 重构 setupPalette() 为循环
void setupPalette()
{
DPalette pa = DGuiApplicationHelper::instance()->standardPalette(DGuiApplicationHelper::LightType);
const QList<QPair<DPalette::ColorType, QColor>> colorOverrides = {
{DPalette::WindowText, QColor("#FFFFFF")},
{DPalette::Text, QColor("#FFFFFF")},
{DPalette::AlternateBase, QColor(0, 0, 0, 76)},
{DPalette::Button, QColor(255, 255, 255, 76)},
{DPalette::Light, QColor(255, 255, 255, 76)},
{DPalette::Dark, QColor(255, 255, 255, 76)},
{DPalette::ButtonText, QColor("#FFFFFF")},
};
for (const auto &pair : colorOverrides) {
pa.setColor(QPalette::Normal, pair.first, pair.second);
DGuiApplicationHelper::generatePaletteColor(pa, pair.first, DGuiApplicationHelper::LightType);
}
DGuiApplicationHelper::instance()->setApplicationPalette(pa);
}
// preLoginWindow.cpp - 提取魔法数字为常量
namespace {
constexpr int COMMIT_BUTTON_WIDTH = 214;
constexpr int COMMIT_BUTTON_HEIGHT = 36;
constexpr int REFERENCE_SCREEN_WIDTH = 1920;
constexpr int CONTENT_LABEL_WIDTH = 800;
constexpr int TOP_SPACING = 60;
constexpr int MIDDLE_SPACING = 20;
}本报告由 AI 代码审查工具自动生成 |
Summary
Test plan
Pms: TASK-396167
Summary by Sourcery
Migrate the pre-login user notice to Qt6 and integrate its configurable greeter startup and multi-monitor behavior.
New Features:
Bug Fixes:
Enhancements:
Build: