-
Notifications
You must be signed in to change notification settings - Fork 40
pick develop/eagle to master #565
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
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
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.
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");
}总体建议:
这些修改建议可以帮助提高代码的质量、安全性和可维护性。 |
|
[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 |
|
/merge |
pick develop/eagle to master