pick develop/eagle to master #565
Merged
deepin-bot[bot] merged 5 commits intolinuxdeepin:masterfrom Nov 28, 2025
Merged
Conversation
-- When disenable wireless, it maybe connneted. pick from: linuxdeepin@e85b470 Log: fix issue Bug: https://pms.uniontech.com/bug-view-308649.html
fix wakeup ps/2 mouse Log: fix wakeup ps/2 mouse. Bug: https://pms.uniontech.com/bug-view-313055.html Change-Id: I84480ecaec50faecd8f841c6f22ccdbee369b294
format the overview of memory display pick from: linuxdeepin@7f7dc01 Log: format the overview of memory display Bug: https://pms.uniontech.com/bug-view-320787.html
-- Show 'x' not show 'X'. Log: fix issue Bug: https://pms.uniontech.com/bug-view-323421.html
Fixed the formatted resolution display of graphics cards by removing redundant spaces. pick from: linuxdeepin@2608aae Log: Improve resolution display formatting Bug: https://pms.uniontech.com/bug-view-324363.html Change-Id: I9c2ee6868354bc2c55c45ffec42ba6a34f3e961d
deepin pr auto review我来对这段代码进行审查,主要从语法逻辑、代码质量、性能和安全几个方面进行分析:
语法逻辑:
代码质量:
性能:
安全:
建议改进代码: bool EnableUtils::ioctlOperateNetworkLogicalName(const QString &logicalName, bool enable)
{
qCDebug(appLog) << "Performing ioctl operation on network interface:" << logicalName << "enable:" << enable;
if (logicalName.startsWith("wlan") || logicalName.startsWith("wlp")) {
// 使用QProcess替代system调用
QProcess process;
// RFKILL操作
QString rfkillCmd = QString("rfkill %1 $(rfkill list | grep -A 2 \"phy$(iw dev %2 info 2>/dev/null | awk '/wiphy/{print $2}')\" | awk 'NR==1{print $1}' | tr -d ':')")
.arg(enable ? "unblock" : "block")
.arg(logicalName);
process.start("/bin/sh", QStringList() << "-c" << rfkillCmd);
process.waitForFinished();
if (process.exitCode() != 0) {
qCritical() << "Failed to block/unblock wifi: " << process.errorString();
return false;
}
// IFCONFIG操作
QString ifconfigCmd = QString("/sbin/ifconfig %1 %2")
.arg(logicalName)
.arg(enable ? "up" : "down");
process.start("/bin/sh", QStringList() << "-c" << ifconfigCmd);
process.waitForFinished();
if (process.exitCode() != 0) {
qCritical() << "Failed to up/down network: " << logicalName << enable << " error: " << process.errorString();
return false;
}
return true;
}
// 原有的有线网卡处理逻辑...
// ...
}
语法逻辑:
代码质量:
语法逻辑:
代码质量:
建议改进代码: const QString DeviceMemory::getOverviewInfo()
{
static const QString format = "%1(%2%3 %4)";
QString nameStr = m_Name;
if (nameStr == "--") {
qCDebug(appLog) << "Name string is '--', clearing it";
nameStr.clear();
}
QString ov = format.arg(m_Size)
.arg(nameStr)
.arg(nameStr.isEmpty() ? "" : " ")
.arg(m_Type)
.arg(m_Speed);
ov = ov.trimmed();
qCDebug(appLog) << "Memory overview info:" << ov;
return ov;
}
语法逻辑:
代码质量:
建议改进代码: QString formatResolution(const QString& resolution) {
return resolution.replace(" ", "")
.replace("x", "×", Qt::CaseInsensitive);
}
// 在使用处:
lstMap[lstMap.count() - 1].insert("curResolution", formatResolution(match.captured(2)));
语法逻辑:
代码质量:
建议改进代码: bool TableWidget::isWakeupEnabled(const QString& wakeupPath, const QString& busInfo, const QString& name) {
if (wakeupPath.contains("/proc/acpi/wakeup")) {
return DBusWakeupInterface::getInstance()->isInputWakeupMachine(busInfo, name);
}
QFile file(wakeupPath);
if (!file.open(QIODevice::ReadOnly)) {
return false;
}
return !file.readAll().contains("disabled");
}总体建议:
这些修改建议可以帮助提高代码的质量、安全性和可维护性。 |
lzwind
approved these changes
Nov 28, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, 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 |
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pick develop/eagle to master