-
Notifications
You must be signed in to change notification settings - Fork 143
fix: fix window effect feature availability and combo box model handling #2986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy 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 |
1. Fixed incorrect D-Bus interface pointer checks in PersonalizationDBusProxy (m_WMInter -> m_EffectsInter) for effect- related operations 2. Added isEffectSupported() method to check if specific window effects are available on the system 3. Extended PersonalizationModel to track supported effects list via new supportEffects property 4. Updated X11Worker to query and populate supported effects (magiclamp, scale, kwin4_effect_translucency) 5. Fixed CustomComboBox.qml to properly handle model data access when using textRole, iconNameRole, enableRole, and visibleRole 6. Updated WindowEffectPage.qml to conditionally show minimize effect and transparent window move options based on actual system support 7. Extended copyright years from 2023/2024 to 2026 across modified files Log: Fixed window effect options not appearing correctly when effects are unsupported Log: Fixed combo box display issues with role-based model data access fix: 修复窗口特效功能可用性和组合框模型处理问题 1. 修复PersonalizationDBusProxy中特效相关操作的D-Bus接口指针检查错误 (m_WMInter -> m_EffectsInter) 2. 新增isEffectSupported()方法用于检查系统是否支持特定窗口特效 3. 扩展PersonalizationModel以通过新的supportEffects属性跟踪支持的特效 列表 4. 更新X11Worker以查询并填充支持的特效(magiclamp、scale、 kwin4_effect_translucency) 5. 修复CustomComboBox.qml在使用textRole、iconNameRole、enableRole和 visibleRole时正确处理模型数据访问 6. 更新WindowEffectPage.qml根据实际系统支持条件显示最小化特效和透明窗口 移动选项 7. 将修改文件的版权年份从2023/2024扩展到2026 Log: 修复特效不支持时窗口特效选项显示不正确的问题 Log: 修复组合框基于角色的模型数据访问显示问题 PMS: BUG-294317 PMS: BUG-301403 PMS: BUG-301407
deepin pr auto reviewGit Diff 代码审查报告总体评价这段代码主要实现了窗口特效功能的增强,包括添加了对特效支持情况的检测和动态显示。代码整体结构合理,但存在一些可以改进的地方,特别是在错误处理、性能优化和代码健壮性方面。 详细审查意见1. 语法逻辑personalizationdbusproxy.cpp
x11worker.cpp
2. 代码质量personalizationdbusproxy.cpp
personalizationmodel.cpp
x11worker.cpp
CustomComboBox.qml
3. 代码性能x11worker.cpp
WindowEffectPage.qml
4. 代码安全personalizationdbusproxy.cpp
x11worker.cpp
改进建议1. personalizationdbusproxy.cppbool PersonalizationDBusProxy::isEffectSupported(const QString &name)
{
if (!m_EffectsInter) {
return false;
}
QDBusPendingReply<bool> reply = m_EffectsInter->asyncCall(QStringLiteral("isEffectSupported"), QVariant::fromValue(name));
reply.waitForFinished();
if (reply.isError()) {
qWarning() << "Failed to check effect support:" << reply.error().message();
return false;
}
return reply.value();
}2. x11worker.cppvoid X11Worker::active()
{
// ... 其他代码 ...
// 获取所有支持的效果列表
QStringList allSupportedEffects;
const QStringList effectsToCheck = {EffectMiniLampArg, EffectMiniScaleArg, EffectMoveWindowArg};
for (const QString &effect : effectsToCheck) {
if (m_personalizationDBusProxy->isEffectSupported(effect)) {
allSupportedEffects.append(effect);
}
}
m_model->setSupportEffects(allSupportedEffects);
}
void X11Worker::setMiniEffect(int effect)
{
switch (effect) {
case 0:
qCDebug(DdcPersonnalizationX11Worker) << EffectMiniScaleArg;
m_personalizationDBusProxy->unloadEffect(EffectMiniLampArg);
m_model->setMiniEffect(effect);
break;
case 1:
qCDebug(DdcPersonnalizationX11Worker) << EffectMiniLampArg;
m_personalizationDBusProxy->loadEffect(EffectMiniLampArg);
m_model->setMiniEffect(effect);
break;
default:
qCWarning(DdcPersonnalizationX11Worker) << "Unknown mini effect type:" << effect;
break;
}
}3. CustomComboBox.qmlD.ComboBox {
id: control
flat: true
delegate: D.MenuItem {
id: menuItem
useIndicatorPadding: true
// 简化条件表达式
text: {
if (!control.textRole) return modelData;
var source = Array.isArray(control.model) ? modelData : model;
return source[control.textRole] !== undefined ? source[control.textRole] : modelData[control.textRole];
}
// 其他属性类似处理
}
}4. WindowEffectPage.qmlDccObject {
id: minimizeEffectObject
property var supportEffects: dccData.model.supportEffects
// 添加计算属性来缓存结果
readonly property bool hasScaleEffect: supportEffects.indexOf("scale") !== -1
readonly property bool hasMagicLampEffect: supportEffects.indexOf("magiclamp") !== -1
name: "minimizeEffect"
parentName: "personalization/windowEffect/windowSettingsGroup"
displayName: qsTr("Window Minimize Effect")
visible: dccData.model.windowEffectType <= InterfaceEffectListview.WindowEffectType.Best
&& dccData.platformName() !== "wayland"
&& (hasScaleEffect || hasMagicLampEffect)
page: CustomComboBox {
flat: true
currentIndex: dccData.model.miniEffect
textRole: "text"
visibleRole: "support"
model: [
{text: qsTr("Scale"), support: minimizeEffectObject.hasScaleEffect},
{text: qsTr("Magic Lamp"), support: minimizeEffectObject.hasMagicLampEffect}
]
onCurrentIndexChanged: {
dccData.worker.setMiniEffect(currentIndex)
}
}
}总结这段代码实现了窗口特效功能的增强,整体结构合理,但在错误处理、性能优化和代码健壮性方面还有改进空间。建议按照上述建议进行修改,以提高代码质量和可维护性。 |
Log: Fixed window effect options not appearing correctly when effects are unsupported
Log: Fixed combo box display issues with role-based model data access
fix: 修复窗口特效功能可用性和组合框模型处理问题
Log: 修复特效不支持时窗口特效选项显示不正确的问题
Log: 修复组合框基于角色的模型数据访问显示问题
PMS: BUG-294317
PMS: BUG-301403
PMS: BUG-301407