Skip to content

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Sep 10, 2025

Updated all debug and warning messages from Chinese to English for better internationalization support and developer consistency.

Log: Unify logging language to English
Bug: https://pms.uniontech.com/bug-view-332349.html

@add-uos add-uos force-pushed the release/eagle branch 3 times, most recently from b414e8d to b33e2f1 Compare September 10, 2025 05:21
max-lvs
max-lvs previously approved these changes Sep 10, 2025
Updated all debug and warning messages from Chinese to English for
better internationalization support and developer consistency.

Log: Unify logging language to English
Bug: https://pms.uniontech.com/bug-view-332349.html
@deepin-ci-robot
Copy link

deepin pr auto review

根据提供的代码差异,我进行了仔细审查,以下是改进意见:

  1. 代码国际化改进:
  • 将所有中文日志信息改为英文,这是一个很好的改进,有助于国际化
  • 建议创建一个统一的日志消息资源文件,便于后续翻译和维护
  1. 代码质量改进:
  • 日志消息格式应该统一,建议使用统一的日志格式规范
  • 在quickFullScreenshot()函数中,建议将重复的日志消息提取为常量或宏定义
  • 时间等待部分可以使用QTimer代替while循环,这样更符合Qt的事件驱动模型
  1. 代码性能改进:
  • 在Wayland模式下的等待机制可以使用QTimer::singleShot替代忙等待,这样可以减少CPU占用
  • 建议添加错误处理的详细程度,比如在截图失败时提供更具体的错误原因
  1. 代码安全改进:
  • 在处理文件路径时,建议使用QDir::toNativeSeparators确保跨平台兼容性
  • 在保存文件前,建议检查目标目录是否存在并可写
  • 建议添加文件权限检查,确保有足够的权限进行文件操作
  1. 其他建议:
  • 建议添加版本信息常量,避免硬编码字符串
  • 可以考虑添加更多的错误处理和恢复机制
  • 建议添加性能监控,记录关键操作耗时

示例改进代码片段:

// 在类定义中添加常量
static const QLatin1String QUICK_FULLSCREEN_START_MSG = "Starting quick fullscreen screenshot...";
static const QLatin1String CLIPBOARD_WAIT_MSG = "Waiting for clipboard data transfer to complete in Wayland mode...";

// 使用QTimer替代忙等待
if (Utils::isWaylandMode) {
    qInfo() << CLIPBOARD_WAIT_MSG;
    QTimer::singleShot(1000, this, [this]() {
        qInfo() << "Clipboard wait completed";
    });
}

// 添加文件检查
QDir saveDir(savePath);
if (!saveDir.exists() && !saveDir.mkpath(".")) {
    qWarning() << "Failed to create save directory:" << savePath;
    QFile::remove(tempImagePath);
    return false;
}

这些改进将有助于提高代码的可维护性、性能和健壮性。

@add-uos
Copy link
Contributor Author

add-uos commented Sep 10, 2025

/merge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Sep 10, 2025

This pr cannot be merged! (status: blocked)

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, max-lvs

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

@add-uos
Copy link
Contributor Author

add-uos commented Sep 11, 2025

/merge

@deepin-bot deepin-bot bot merged commit df3c3cf into linuxdeepin:release/eagle Sep 11, 2025
7 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