Skip to content

Conversation

@ut003640
Copy link
Contributor

add debug project for dde-session-shell and dde-dock

Log: add test project
Influence: debug for project

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @ut003640, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@@ -0,0 +1,153 @@
// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

时间改为2026年,修改的文件都要修改时间

add debug project for dde-session-shell and dde-dock

Log: add test project
Influence: debug for project
caixr23
caixr23 previously approved these changes Jan 28, 2026
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ut003640

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ut003640

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link

deepin pr auto review

Git Diff 代码审查报告

我已仔细审查了提供的 git diff,主要涉及 CMakeLists.txt 的修改以及新增的 dock-example 和 dss_example 目录。以下是我的审查意见:

1. CMakeLists.txt 修改

语法逻辑

  • 添加了 BUILD_EXAMPLE 选项,默认值为 OFF,这是合理的
  • 在 Debug 构建模式下自动设置 BUILD_EXAMPLE 为 ON,这有助于开发调试
  • 使用 CMAKE_BUILD_TYPE STREQUAL "Debug" 检查构建类型,语法正确

代码质量

  • 建议为 BUILD_EXAMPLE 选项添加更详细的描述,例如:
    option(BUILD_EXAMPLE "Build example programs for testing and demonstration" OFF)
  • 在 Debug 模式下自动启用示例构建是合理的,但最好添加注释说明原因

代码性能

  • 无明显性能问题

代码安全

  • 无明显安全问题

2. dock-example 目录新增文件

2.1 dock-example/CMakeLists.txt

语法逻辑

  • 基本结构正确,使用了现代 CMake 特性
  • 使用 target_include_directoriestarget_link_libraries 的现代语法是正确的

代码质量

  • 建议将 set(CMAKE_CXX_STANDARD 11) 提升到 14 或更高,因为 Qt6 需要 C++17
  • set(CMAKE_PREFIX_PATH $ENV{Qt6_DIR}) 依赖于环境变量,建议添加检查:
    if(NOT DEFINED Qt6_DIR AND NOT DEFINED ENV{Qt6_DIR})
        message(FATAL_ERROR "Qt6_DIR must be set")
    endif()
  • 使用 file(GLOB SRCS "*.cpp" "*.h") 虽然方便,但不推荐,因为添加新文件时可能需要重新运行 CMake。建议显式列出源文件。

代码性能

  • 无明显性能问题

代码安全

  • 无明显安全问题

2.2 dockpopupwindow.cpp/h

语法逻辑

  • 代码结构清晰,继承自 DArrowRectangle
  • 实现了基本的弹出窗口功能

代码质量

  • DockPopupWindow::show(const QPoint &pos, const bool model) 中参数名 model 与成员变量 m_model 命名相似,容易混淆,建议改为 isModal
  • blockButtonRelease() 方法中使用 QTimer::singleShot(10, ...),这个 10ms 的延迟可能不够,建议考虑增加到 50-100ms
  • eventFilter 方法中使用了 lambda 表达式,建议提取为单独的方法以提高可读性
  • compositeChanged() 方法中硬编码的颜色值应该考虑从主题获取

代码性能

  • eventFilter 中使用 QTimer::singleShot(10, ...) 可能导致频繁的定时器创建和销毁,考虑使用单个定时器并重置它

代码安全

  • onGlobMouseRelease 方法中使用了 Q_ASSERT(m_model),在发布版本中会被移除,建议添加运行时检查
  • onGlobMouseRelease 中没有检查 mousePos 是否为有效值,可能导致未定义行为

2.3 docktestwidget.cpp/h

语法逻辑

  • 实现了基本的网络插件测试功能
  • 实现了 PluginProxyInterface 接口

代码质量

  • enterEvent 方法中使用 QMessageBox::information 显示提示,这在实际应用中可能不太合适,建议使用工具提示或状态栏
  • trayTipsWidget 方法中硬编码了网络信息,应该从实际网络状态获取
  • createNetworkPopupApplet 方法中硬编码了样式,建议使用样式表或主题系统
  • eventFilter 方法过长,建议拆分为多个方法

代码性能

  • eventFilter 中每次鼠标事件都会创建新的 QMenu 对象,考虑重用菜单对象

代码安全

  • eventFilter 中没有充分检查事件类型和鼠标按钮,可能导致未定义行为
  • showPopupWindow 方法中没有检查 content 是否为空指针

3. dss_example 目录修改

3.1 dss_example/CMakeLists.txt

语法逻辑

  • 修改了源文件收集方式,现在只包含当前目录的文件

代码质量

  • 删除了对 DdeControlCenterDdeSessionShell 的依赖,如果这些依赖不再需要,这是合理的
  • 移除了 protoc 自定义命令,如果不再需要生成 protobuf 文件,这是合理的

代码性能

  • 无明显性能问题

代码安全

  • 无明显安全问题

3.2 dsstestwidget.cpp/h

语法逻辑

  • 简化了测试窗口的实现,移除了对 NetworkPlugin 的依赖

代码质量

  • 使用 QMessageBox::information 显示点击事件,这是测试代码,可以接受
  • 移除了 loadDssPlugin 方法,简化了代码结构

代码性能

  • 无明显性能问题

代码安全

  • 无明显安全问题

总体建议

  1. 代码组织:考虑将示例代码放在单独的目录中,并添加 README 文件说明如何构建和运行这些示例。

  2. 错误处理:在多个地方缺少对空指针和无效值的检查,应该添加适当的错误处理。

  3. 资源管理:考虑使用智能指针管理动态分配的对象,避免内存泄漏。

  4. 文档:添加更多的注释和文档,特别是对于复杂的逻辑和算法。

  5. 测试:考虑添加单元测试,特别是对于关键功能。

  6. 代码复用dockpopupwindowdsstestwidget 中有重复的代码,考虑提取公共部分。

  7. 国际化:示例中的字符串应该考虑国际化,使用 QObject::tr() 包装。

  8. 版本控制:确保所有文件的版权声明和许可证信息一致。

这些修改总体上是为了添加示例程序和简化现有示例代码,方向是正确的。通过上述建议,可以进一步提高代码质量、可维护性和可靠性。

@ut003640
Copy link
Contributor Author

/merge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 28, 2026

This pr cannot be merged! (status: blocked)

@ut003640
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 28, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 1425771 into linuxdeepin:master Jan 28, 2026
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants