Skip to content

Commit a36e4b0

Browse files
add-uosdeepin-bot[bot]
authored andcommitted
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
1 parent 3b01762 commit a36e4b0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
105105
setAttribute(mapInfo, "", m_DisplayInput);
106106
setAttribute(mapInfo, "Size", m_ScreenSize);
107107
setAttribute(mapInfo, "", m_MainScreen);
108-
if (Common::isHwPlatform()){
108+
if (!Common::isHwPlatform()){
109109
setAttribute(mapInfo, "Resolution", m_SupportResolution);
110110
}
111111
qCDebug(appLog) << "Basic monitor attributes set - Name:" << m_Name << "Vendor:" << m_Vendor << "Model:" << m_Model;
@@ -117,7 +117,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
117117
qCDebug(appLog) << "Screen size parsed:" << m_ScreenSize << "Width:" << size.width() << "Height:" << size.height();
118118

119119
// 获取当前分辨率 和 当前支持分辨率
120-
if (Common::isHwPlatform()){
120+
if (!Common::isHwPlatform()){
121121
QStringList listResolution = m_SupportResolution.split(" ");
122122
m_SupportResolution = "";
123123
foreach (const QString &word, listResolution) {
@@ -131,7 +131,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
131131
// 计算显示比例
132132
caculateScreenRatio();
133133

134-
if (Common::isHwPlatform()){
134+
if (!Common::isHwPlatform()){
135135
m_SupportResolution.replace(QRegularExpression(", $"), "");
136136
}
137137
qCDebug(appLog) << "Supported resolutions processed:" << m_SupportResolution;

deepin-devicemanager/src/GenerateDevice/CmdTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ void CmdTool::getMapInfoFromSmartctl(QMap<QString, QString> &mapInfo, const QStr
15531553

15541554
indexName = "";
15551555

1556-
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-()]*)$");
1556+
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\\/\\-\\(\\)]*)$");
15571557
if (rx.match(line).hasMatch()) {
15581558
// qCDebug(appLog) << "Matched smartctl attribute regex:" << line;
15591559
mapInfo[rx.match(line).captured(1)] = rx.match(line).captured(2);

0 commit comments

Comments
 (0)