Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add systemReboot config #395

Merged
merged 1 commit into from
Feb 26, 2025
Merged

fix: add systemReboot config #395

merged 1 commit into from
Feb 26, 2025

Conversation

mhduiy
Copy link
Contributor

@mhduiy mhduiy commented Feb 25, 2025

as title

pms: TASK-368711

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, yixinshark

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

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

as title

pms: TASK-368711
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 配置文件中的描述不一致

    • configs/org.deepin.dde.session-shell.json文件中,systemRebootdescriptiondescription[zh_CN]字段存在不一致,分别为"0:Enabled。1:Disabled。2:Hidden"和"0:启用。1:禁用。2:隐藏"。建议统一描述格式,保持一致性。
  2. 新增代码的注释缺失

    • src/widgets/shutdownwidget.cpp文件中新增的代码块缺少注释说明,特别是新增的onEnableinitUI函数中的代码,应添加相应的注释以便其他开发者理解其用途。
  3. 重复的代码逻辑

    • recoveryLayout函数中,m_requireRestartButton->setVisible的逻辑与onEnable函数中的逻辑重复。建议将这部分逻辑提取到一个公共函数中,以减少代码重复。
  4. 未处理的异常情况

    • ShutdownWidget的构造函数和析构函数中,调用了DConfigWatcher::instance()->erase方法,但没有处理可能出现的异常情况。建议添加异常处理逻辑,确保程序的健壮性。
  5. 按钮状态更新逻辑

    • onEnable函数中,m_requireRestartButton->setCheckable(enable);这行代码可能不必要,因为m_requireRestartButton已经被设置为setAutoExclusive(true);,通常情况下,自动排他按钮不需要手动设置可检查状态。
  6. 国际化字符串的格式

    • configs/org.deepin.dde.session-shell.json文件中,namedescription字段的国际化字符串格式不一致,建议统一使用小写字母和空格分隔单词。
  7. 未使用的变量

    • ShutdownWidget的构造函数中,index变量被声明但未使用。建议移除未使用的变量,以保持代码的整洁。
  8. 潜在的逻辑错误

    • recoveryLayout函数中,m_requireShutdownButton->setVisible(true && (DConfigWatcher::instance()->getStatus("systemShutdown") != Status_Hidden));这行代码中,true &&部分是多余的,可以直接写为DConfigWatcher::instance()->getStatus("systemShutdown") != Status_Hidden

综上所述,代码在配置文件的一致性、注释、代码重复、异常处理、按钮状态更新逻辑、国际化字符串格式、未使用变量和潜在逻辑错误等方面存在改进空间。

@mhduiy mhduiy merged commit 82dcbef into linuxdeepin:master Feb 26, 2025
17 of 18 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