From ebc8403b2536047d7b2e2992c985c368102c71a4 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 31 Dec 2025 14:41:37 +0800 Subject: [PATCH] fix(monitor): correct platform condition logic and regex pattern - Fixed monitor resolution display logic (negated isHwPlatform condition) - Enhanced smartctl regex to better match device identifier patterns log: correct platform condition logic and regex pattern bug: https://pms.uniontech.com/bug-view-340917.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 6 +++--- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index b53f9a14..221fd0c1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -105,7 +105,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) setAttribute(mapInfo, "", m_DisplayInput); setAttribute(mapInfo, "Size", m_ScreenSize); setAttribute(mapInfo, "", m_MainScreen); - if (Common::isHwPlatform()){ + if (!Common::isHwPlatform()){ setAttribute(mapInfo, "Resolution", m_SupportResolution); } qCDebug(appLog) << "Basic monitor attributes set - Name:" << m_Name << "Vendor:" << m_Vendor << "Model:" << m_Model; @@ -117,7 +117,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) qCDebug(appLog) << "Screen size parsed:" << m_ScreenSize << "Width:" << size.width() << "Height:" << size.height(); // 获取当前分辨率 和 当前支持分辨率 - if (Common::isHwPlatform()){ + if (!Common::isHwPlatform()){ QStringList listResolution = m_SupportResolution.split(" "); m_SupportResolution = ""; foreach (const QString &word, listResolution) { @@ -131,7 +131,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) // 计算显示比例 caculateScreenRatio(); - if (Common::isHwPlatform()){ + if (!Common::isHwPlatform()){ m_SupportResolution.replace(QRegularExpression(", $"), ""); } qCDebug(appLog) << "Supported resolutions processed:" << m_SupportResolution; diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 599756a8..0445332f 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -1553,7 +1553,7 @@ void CmdTool::getMapInfoFromSmartctl(QMap &mapInfo, const QStr indexName = ""; - QRegularExpression rx("^[ ]*[0-9]+[ ]+([\\w-_]+)[ ]+0x[0-9a-fA-F-]+[ ]+[0-9]+[ ]+[0-9]+[ ]+[0-9]+[ ]+[\\w-]+[ ]+[\\w-]+[ ]+[\\w-]+[ ]+([0-9\\/w-]+[ ]*[ 0-9\\/w-()]*)$"); + QRegularExpression rx("^[ ]*[0-9]+[ ]+([\\w_-]+)[ ]+0x[0-9a-fA-F-]+[ ]+[0-9]+[ ]+[0-9]+[ ]+[0-9]+[ ]+[\\w-]+[ ]+[\\w-]+[ ]+[\\w-]+[ ]+([0-9\\w\\/-]+[ ]*[0-9\\w\\/\\-\\(\\)]*)$"); if (rx.match(line).hasMatch()) { // qCDebug(appLog) << "Matched smartctl attribute regex:" << line; mapInfo[rx.match(line).captured(1)] = rx.match(line).captured(2);