Repository navigation
feat(shot): add rounded corner and size ratio widgets - #950
Conversation
Add rounded corner and size/ratio floating panels, icons and i18n. 新增圆角与尺寸/比例悬浮面板、图标及国际化文案。 Log: 新增圆角与尺寸比例设置面板 PMS: TASK-393987 Influence: 截图选区支持圆角预览及尺寸比例设置入口。
Integrate panel with selection, preview, ratio lock and image output. 将圆角与尺寸比例面板接入选区、比例锁定、预览和成图流程。 Log: 接入圆角与尺寸比例截图 PMS: TASK-393987 Influence: 截图和贴图支持圆角、固定尺寸、固定比例及下次启动记忆。
|
Sorry @dengzhongyuan365-dev, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 3 days by commenting |
Reviewer's GuideIntroduces a selection-attached floating control widget for rounded-corner previews and editable size/aspect-ratio settings, persists those preferences, enforces ratio-aware resizing, and carries the rounded result through screenshot output with supporting icons and Chinese translations. Sequence diagram for rounded screenshot capturesequenceDiagram
actor User
participant MainWindow
participant RoundedCornerWidget
participant ScreenshotOutput
User->>MainWindow: Select screenshot region
MainWindow->>RoundedCornerWidget: followSelection(selection, screen)
User->>RoundedCornerWidget: Change radius
RoundedCornerWidget-->>MainWindow: radiusChanged(radius)
MainWindow->>MainWindow: update(dirty)
User->>MainWindow: Save screenshot
MainWindow->>RoundedCornerWidget: applyRoundedCorners(pix, radius)
MainWindow->>ScreenshotOutput: saveImg(savePix, fileName, format, quality)
Sequence diagram for ratio-aware selection resizingsequenceDiagram
actor User
participant RoundedCornerWidget
participant MainWindow
User->>RoundedCornerWidget: Select Ratio mode
User->>RoundedCornerWidget: Enable ratio lock
User->>MainWindow: Drag selection edge
MainWindow->>MainWindow: applyLockedRatioToSelection()
MainWindow->>RoundedCornerWidget: setSelectionSize(width, height)
User->>RoundedCornerWidget: Edit width or height
RoundedCornerWidget-->>MainWindow: selectionSizeChanged(width, height)
MainWindow->>MainWindow: onRoundedSelectionSizeChanged(width, height)
Entity relationship diagram for persisted rounded selection settingserDiagram
CONFIG_SETTINGS {
string group
string key
variant value
}
ROUNDED_SETTINGS {
int radius
int ratio_type
bool remember
bool remember_ratio
int fixed_width
int fixed_height
}
CONFIG_SETTINGS ||--|| ROUNDED_SETTINGS : stores
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto reviewAI 代码审查报告
总体评价
总体评价: 代码审查通过。未发现安全漏洞,代码结构清晰,注释详尽,性能优化到位。本次提交为截图选区新增圆角预览及尺寸比例设置功能,实现完整,逻辑严谨,边界处理完善。 漏洞统计漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
修改文件清单代码文件(5个,需分析):
跳过文件(13个):
维度1:语法逻辑(25/25)✓
审查内容本次提交涉及主窗口集成和新组件开发,代码逻辑完整严谨。 主窗口集成(main_window.cpp):
新组件(roundedcornerwidget.cpp):
边界条件处理
维度2:代码质量(21/25)✓
优点
问题
维度3:代码性能(19/20)✓
性能优化亮点
问题
维度4:代码安全(30/30)✓
安全审查
改进建议建议1:提取重复的编辑完成处理逻辑// 重构建议:将 width/height editingFinished 提取为共享方法
void RoundedCornerWidget::commitDimensionEdit(bool widthChanged)
{
if (m_syncingSelectionSize) {
return;
}
const int maxValue = m_ratioLocked ? MAX_RATIO_VALUE : MAX_DIMENSION_VALUE;
const int widthValue = qBound(1, m_widthEdit->text().toInt(), maxValue);
const int heightValue = qBound(1, m_heightEdit->text().toInt(), maxValue);
if (m_ratioLocked) {
if (widthChanged) {
const int anchorHeight = qMax(1, m_selectionHeight);
m_selectionWidth = qMax(1, qRound(anchorHeight * static_cast<qreal>(widthValue) / heightValue));
m_selectionHeight = anchorHeight;
} else {
const int anchorWidth = qMax(1, m_selectionWidth);
m_selectionHeight = qMax(1, qRound(anchorWidth * static_cast<qreal>(heightValue) / widthValue));
m_selectionWidth = anchorWidth;
}
} else {
m_selectionWidth = widthValue;
m_selectionHeight = heightValue;
}
updateDimensionFields();
persistFixedSize();
emit selectionSizeChanged(m_selectionWidth, m_selectionHeight);
}建议2:缓存着色图标// 在 SelectionLockButton 中缓存着色后的图标
class SelectionLockButton : public DIconButton
{
// ...
private:
QIcon m_cachedActiveIcon;
QIcon m_cachedNormalIcon;
void updateCachedIcons(const QColor &activeColor, const QColor &normalColor) {
m_cachedActiveIcon = tintedIcon(icon(), iconSize(), activeColor);
m_cachedNormalIcon = tintedIcon(icon(), iconSize(), normalColor);
}
};审查结论本次提交为 deepin-screen-recorder 截图功能新增圆角预览及尺寸比例设置面板,代码质量优秀。提交目的明确(feat: 新增功能),实现与 commit message 描述一致。代码注释详尽,性能优化到位(防抖落盘、局部重绘),安全无漏洞。主要改进点为消除 editingFinished 处理器中的代码重复。建议合并。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
feat(shot): add rounded corner and size ratio widgets
Add rounded corner and size/ratio floating panels, icons and i18n.
新增圆角与尺寸/比例悬浮面板、图标及国际化文案。
Log: 新增圆角与尺寸比例设置面板
PMS: TASK-393987
Influence: 截图选区支持圆角预览及尺寸比例设置入口。
Summary by Sourcery
Add rounded-corner preview and size/aspect-ratio controls to the screenshot selection workflow.
New Features:
Bug Fixes:
Enhancements: