Skip to content

Commit 31b2fbb

Browse files
committed
fix: unify resolution display format to use ASCII 'x'
Remove Unicode multiplication sign replacement and extra spaces from resolution strings, standardizing to plain 'WxH' format across all display adapter resolution fields. 统一显示适配器分辨率格式,移除 Unicode 乘号和多余空格, 全部使用 ASCII 'x' 格式(如 1920x1080)。 Log: 统一分辨率显示格式为 ASCII x PMS: BUG-351831 Influence: 显示适配器的当前分辨率、最小分辨率、最大分辨率显示格式统一,不再出现格式不一致的情况。
1 parent d5e836d commit 31b2fbb

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c
265265
if (pos > 0 && curRate.size() > pos && !Common::boardVendorType().isEmpty()) {
266266
curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos);
267267
}
268-
m_CurrentResolution = QString("%1@%2").arg(match.captured(1)).arg(curRate).replace("x", "×", Qt::CaseInsensitive);
268+
m_CurrentResolution = match.captured(1) + "@" + curRate;
269269
} else {
270270
qCDebug(appLog) << "Rate is empty";
271-
m_CurrentResolution = QString("%1").arg(match.captured(1)).replace("x", "×", Qt::CaseInsensitive);
271+
m_CurrentResolution = match.captured(1);
272272
}
273273
}
274274
}
@@ -484,13 +484,13 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra
484484
m_RefreshRate = QString("%1").arg(curRate);
485485
}
486486
if (Common::specialComType == 5 || Common::specialComType == 6) {
487-
m_CurrentResolution = QString("%1").arg(match.captured(1)).replace("x", "×", Qt::CaseInsensitive);
487+
m_CurrentResolution = match.captured(1);
488488
} else {
489-
m_CurrentResolution = QString("%1 @%2").arg(match.captured(1)).arg(curRate).replace("x", "×", Qt::CaseInsensitive);
489+
m_CurrentResolution = match.captured(1) + "@" + curRate;
490490
}
491491
} else {
492492
qCDebug(appLog) << "Rate is empty, setting current resolution without rate";
493-
m_CurrentResolution = QString("%1").arg(match.captured(1).replace("x", "×", Qt::CaseInsensitive));
493+
m_CurrentResolution = match.captured(1);
494494
}
495495
}
496496

deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -101,9 +101,9 @@ void ThreadExecXrandr::loadXrandrInfo(QList<QMap<QString, QString>> &lstMap, con
101101
QRegularExpression re(".*\\s([0-9]{1,5}\\sx\\s[0-9]{1,5}).*\\s([0-9]{1,5}\\sx\\s[0-9]{1,5}).*\\s([0-9]{1,5}\\sx\\s[0-9]{1,5}).*");
102102
QRegularExpressionMatch match = re.match(line);
103103
if (match.hasMatch()) {
104-
lstMap[lstMap.count() - 1].insert("minResolution", match.captured(1));
105-
lstMap[lstMap.count() - 1].insert("curResolution", match.captured(2).replace(" ", "").replace("x", "×", Qt::CaseInsensitive));
106-
lstMap[lstMap.count() - 1].insert("maxResolution", match.captured(3));
104+
lstMap[lstMap.count() - 1].insert("minResolution", match.captured(1).replace(" ", ""));
105+
lstMap[lstMap.count() - 1].insert("curResolution", match.captured(2).replace(" ", ""));
106+
lstMap[lstMap.count() - 1].insert("maxResolution", match.captured(3).replace(" ", ""));
107107
qCDebug(appLog) << "Parsed resolutions: min" << match.captured(1) << "cur" << match.captured(2) << "max" << match.captured(3);
108108
}
109109
continue;
@@ -395,8 +395,8 @@ void ThreadExecXrandr::getResolutionFromDBus(QMap<QString, QString> &lstMap)
395395
}
396396

397397
if (maxResolutionWidth != -1) {
398-
lstMap.insert("maxResolution", QString("%1 x %2").arg(maxResolutionWidth).arg(maxResolutionHeight));
399-
lstMap.insert("minResolution", QString("%1 x %2").arg(minResolutionWidth).arg(minResolutionHeight));
398+
lstMap.insert("maxResolution", QString("%1x%2").arg(maxResolutionWidth).arg(maxResolutionHeight));
399+
lstMap.insert("minResolution", QString("%1x%2").arg(minResolutionWidth).arg(minResolutionHeight));
400400
}
401401
}
402402

0 commit comments

Comments
 (0)