Skip to content

Conversation

@lichaofan2008
Copy link
Contributor

缩略图居中显示

Bug: https://pms.uniontech.com/bug-view-280001.html
Log: 缩略图居中显示

v20 BUG 分支合一到v25主线
Task: https://pms.uniontech.com/task-view-383475.html

myk1343 and others added 5 commits December 19, 2025 11:03
缩略图居中显示

Bug: https://pms.uniontech.com/bug-view-280001.html
Log: 缩略图居中显示

v20 BUG 分支合一到v25主线
Task: https://pms.uniontech.com/task-view-383475.html
修复查看750 X 7882尺寸图片问题

Bug: https://pms.uniontech.com/bug-view-310713.html
Log: 修复查看750 X 7882尺寸图片问题

v20 BUG 分支合一到v25主线
Task: https://pms.uniontech.com/task-view-383475.html
修复右键打印不识别改后缀的图片问题

Bug: https://pms.uniontech.com/bug-view-315823.html
Log: 修复右键打印不识别改后缀的图片问题

v20 BUG 分支合一到v25主线
Task: https://pms.uniontech.com/task-view-383475.html
-- The Next button should clicked double.
-- The last animation not stop and logic return.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-328371.html

v20 BUG 分支合一到v25主线
Task: https://pms.uniontech.com/task-view-383475.html
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这段代码进行审查,从语法逻辑、代码质量、性能和安全几个方面分析:

  1. printimageloader.cpp 修改:
if (!reader.canRead()) {
    reader.setAutoDetectImageFormat(true);
    reader.setDecideFormatFromContent(true);
    reader.setFileName(imagePtr->filePath);
}

优点:

  • 增加了图片格式容错处理,通过内容识别格式而不是依赖文件扩展名
  • 提高了图片加载的兼容性

建议:

  • 可以在设置文件名后再次检查 reader.canRead(),以确保格式切换成功
  • 建议添加错误日志,记录格式切换的情况
  1. quickprint.cpp 修改:
#if DTK_VERSION > DTK_VERSION_CHECK(5, 4, 10, 0)
    // 异步打印相关代码
#else
    // 同步打印代码
#endif

优点:

  • 增加了版本兼容性处理
  • 使用了条件编译确保不同版本的正确运行

建议:

  • 建议将版本号定义为常量,便于维护
  • 可以添加注释说明不同版本的具体差异
  1. imageanimation.cpp 修改:
void LibImageAnimationPrivate::forceStopCurrentAnimation()
{
    if (m_continuousanimationTimer) {
        m_continuousanimationTimer->stop();
        m_continuousanimationTimer->setInterval(0);
        m_factor = 0.0f;
        m_isAnimationIng = false;
    }
    if (m_staticTimer) {
        m_staticTimer->stop();
        m_staticTimer->setInterval(0);
    }
}

优点:

  • 增加了动画强制停止功能
  • 统一了动画停止逻辑
  • 正确处理了定时器状态

建议:

  • 可以考虑在停止动画时释放相关资源
  • 建议添加参数控制是否需要重置动画状态
  1. unionimage.cpp 修改:
if (!reader.canRead()) {
    reader.setAutoDetectImageFormat(true);
    reader.setDecideFormatFromContent(true);
    reader.setFileName(path);
}

优点:

  • 与 printimageloader.cpp 类似,增加了图片格式容错处理

建议:

  • 这段代码与 printimageloader.cpp 中的代码重复,建议提取为公共函数
  • 可以添加格式识别失败的错误处理
  1. imgviewdelegate.cpp 修改:
backgroundRect.setTopLeft(QPoint(backgroundRect.topLeft() + QPoint(0, NORMAL_ITEM_PAINT_OFFSET + 3)));
backgroundRect.setBottomRight(QPoint(backgroundRect.bottomRight() + QPoint(0, NORMAL_ITEM_PAINT_OFFSET + 3)));

优点:

  • 调整了视图项的偏移量

建议:

  • 硬编码的数值 3 应该定义为常量
  • 建议添加注释说明调整的原因
  • 可以考虑将偏移量计算提取为单独函数

总体建议:

  1. 代码中有重复的图片格式处理逻辑,建议提取为公共函数
  2. 硬编码的数值应该定义为常量
  3. 增加更多的错误处理和日志记录
  4. 考虑添加单元测试覆盖新增的功能
  5. 版本检查相关的代码应该集中管理
  6. 建议添加更多的代码注释说明修改的原因和目的

这些修改整体上是合理的,主要提高了代码的健壮性和兼容性,但还可以进一步优化代码结构和可维护性。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lichaofan2008, lzwind

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

@lichaofan2008
Copy link
Contributor Author

/merge

@deepin-bot deepin-bot bot merged commit f696237 into linuxdeepin:master Dec 23, 2025
20 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.

5 participants