Skip to content

fix: adjust height calculation order in BluetoothApplet#338

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-320239
Jul 16, 2025
Merged

fix: adjust height calculation order in BluetoothApplet#338
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-320239

Conversation

@wjyrich

@wjyrich wjyrich commented Jul 16, 2025

Copy link
Copy Markdown
Contributor
  1. Reordered the height calculation logic to prioritize maximum height check before minimum height check
  2. This prevents potential layout issues when content height exceeds maximum allowed height
  3. Maintains the same functionality but with more logical calculation flow
  4. The change ensures consistent behavior when dealing with edge cases

fix: 调整蓝牙小程序高度计算顺序

  1. 重新排序高度计算逻辑,优先检查最大高度限制再检查最小高度限制
  2. 防止当内容高度超过允许最大值时可能出现的布局问题
  3. 保持相同功能但采用更合理的计算流程
  4. 此变更确保处理边界情况时行为一致

Pms: BUG-320239

Summary by Sourcery

Bug Fixes:

  • Apply maximum height constraint before minimum height constraint to prevent layout issues when content exceeds allowed size

1. Reordered the height calculation logic to prioritize maximum height
check before minimum height check
2. This prevents potential layout issues when content height exceeds
maximum allowed height
3. Maintains the same functionality but with more logical calculation
flow
4. The change ensures consistent behavior when dealing with edge cases

fix: 调整蓝牙小程序高度计算顺序

1. 重新排序高度计算逻辑,优先检查最大高度限制再检查最小高度限制
2. 防止当内容高度超过允许最大值时可能出现的布局问题
3. 保持相同功能但采用更合理的计算流程
4. 此变更确保处理边界情况时行为一致

Pms: BUG-320239
@sourcery-ai

sourcery-ai Bot commented Jul 16, 2025

Copy link
Copy Markdown

Reviewer's Guide

The PR refactors BluetoothApplet::updateSize by reordering the height clamp logic to apply the maximum height limit before enforcing the minimum height, ensuring consistent layout behavior when content height exceeds bounds.

File-Level Changes

Change Details Files
Reorder height clamp sequence to prioritize max height before min height
  • Remove original minimum-height check preceding the max-height clamp
  • Add minimum-height enforcement immediately after applying max-height constraint
plugins/dde-dock/bluetooth/componments/bluetoothapplet.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码格式和风格

    • 代码缩进和格式看起来已经整理过,但建议保持整个项目的代码风格一致,例如使用统一的空格数进行缩进。
  2. 逻辑和功能

    • 代码逻辑清晰,没有发现明显的逻辑错误。
    • 确保在修改代码时,相关的注释和文档也进行了相应的更新,以便其他开发者理解代码的变更。
  3. 性能

    • 没有发现明显的性能问题,但是建议定期进行性能测试,以确保代码的运行效率。
  4. 安全性

    • 代码中没有涉及到安全性问题,例如SQL注入、XSS攻击等。
  5. 可维护性

    • 代码的可读性和可维护性较好,但建议添加更多的注释,特别是在复杂的逻辑判断和计算中,以便于未来的维护和扩展。
  6. 其他建议

    • 考虑将高度计算逻辑封装成一个函数,以提高代码的可读性和可维护性。
    • 如果m_airplaneModeWidget->isVisibleTo(this)的判断逻辑较为复杂,可以考虑将其提取到一个单独的函数中,以简化主函数的逻辑。

总体来说,代码的修改看起来是合理的,没有引入新的问题,但是可以进一步优化以提高代码质量和可维护性。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @wjyrich - I've reviewed your changes - here's some feedback:

  • Consider replacing the two-step qMin / qMax logic with a single clamp (e.g. qBound) for clearer intent and fewer lines.
  • Add an assertion or guard to ensure m_minHeight (after subtracting margins) never exceeds maxHeight to avoid invalid layout states.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider replacing the two-step qMin / qMax logic with a single clamp (e.g. qBound) for clearer intent and fewer lines.
- Add an assertion or guard to ensure m_minHeight (after subtracting margins) never exceeds maxHeight to avoid invalid layout states.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, wjyrich

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

@wjyrich

wjyrich commented Jul 16, 2025

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 16, 2025

Copy link
Copy Markdown

This pr force merged! (status: behind)

@deepin-bot deepin-bot Bot merged commit 26d8a87 into linuxdeepin:master Jul 16, 2025
7 of 9 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