fix(shot): hide record button on toolbar under Treeland#855
Conversation
- Add isTreelandMode check before appending recorder button to toolbar layout in initShotLabel() - Consistent with existing Treeland gating pattern for mosaic and scrollshot buttons 在截图工具栏初始化时增加 Treeland 环境判断, 当运行在 Treeland 合成器下时不将录屏按钮加入工具栏布局, 与模糊按钮和滚动截图按钮的屏蔽方式保持一致。 Log: Treeland合成器下截图工具栏不再显示录屏功能入口 PMS: TASK-389563 Influence: 截图工具栏在Treeland合成器下不再展示录屏切换按钮
deepin pr auto review你好!我是CodeGeeX,你的智能编程助手。我已经仔细审查了你提供的Git Diff代码。这段代码的主要意图是在 TreeLand 环境下暂时屏蔽录屏功能。 以下是我从语法逻辑、代码质量、代码性能和代码安全四个维度进行的详细审查和改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进后的代码建议基于以上分析,我为你重构了这部分代码:
void MainWindow::initLaunchMode(const QString &launchMode)
{
qCDebug(dsrApp) << "initLaunchMode";
m_functionType = status::shot;
// 建议将 "screenRecord" 提取为常量,这里暂保持原样
// 逻辑上:只有在非 TreeLand 模式下,才允许进入录屏初始化分支
if (launchMode == "screenRecord" && !Utils::isTreelandMode) {
qCDebug(dsrApp) << "initLaunchMode screenRecord";
m_sizeTips->setRecorderTipsInfo(true);
m_sizeTips->updateTips(QPoint(recordX, recordY), QSize(recordWidth, recordHeight));
}
// ... 其他逻辑
}
// 删除旧的无用注释:// TreeLand环境下现在已支持录屏功能
// TODO: TreeLand暂时屏蔽录屏功能,待功能完善后移除此判断
m_recorderButton = new ToolButton();
m_recorderButton->setCheckable(false);
m_recorderButton->setIconSize(TOOL_ICON_SIZE);
m_recorderButton->setNormalIcon(":/icons/deepin/builtin/normal_icons/record_normal.svg");
Utils::setAccessibility(m_recorderButton, AC_SUBTOOLWIDGET_RECORDER_BUTTON);
m_recorderButton->setFixedSize(TOOL_BUTTON_SIZE); // 修正了原有的缩进问题
installTipHint(m_recorderButton, tr("Record"));
// 使用大括号明确作用域,确保 UI 隐藏的同时,信号槽也不进行连接
if (!Utils::isTreelandMode) {
btnList.append(m_recorderButton);
connect(m_recorderButton, &ToolButton::clicked, this, [ = ] {
m_pMainWindow->getToolBarPoint();
// ... 其他录屏相关逻辑
});
}总结: 最核心的修改点是必须给 |
|
[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) |
在截图工具栏初始化时增加 Treeland 环境判断,
当运行在 Treeland 合成器下时不将录屏按钮加入工具栏布局,
与模糊按钮和滚动截图按钮的屏蔽方式保持一致。
Log: Treeland合成器下截图工具栏不再显示录屏功能入口
PMS: TASK-389563
Influence: 截图工具栏在Treeland合成器下不再展示录屏切换按钮